Help using Custom Fields to dictate post background image
-
I am trying to make it so using Custom Fields, I can enter in a value that will dictate which background image file will be used (tiled) to fill the background of my post.
For example Key = “Post Background” and Value=”brick”
In my loop I was trying this:
<?php while (have_posts()) : the_post();
$post_back = get_post_meta($post->ID, ‘Post Background’, $single = true);and then below inside the <div> for the background I was trying this:
<img src=”/site-images/<?php echo $post_back;?>.jpg”;/>
This was calling up the image but I was unable to figure out how to tile it so it fills the entire <div> (repeat-x i.e.). But more importantly, this way makes the image part of the post and not as the actual background which is what I am trying to do. I of course am used to doing this with css.
I am obviously new to php. Does anyone know how with Custom Fields, I could call up a background image and css properties on it?
Thanks! Trimmode
(Forgot to add that I am using WP 2.6)
- The topic ‘Help using Custom Fields to dictate post background image’ is closed to new replies.