How can I call the featured image of each post to act as a background?
-
I am using theme TwentyTen. I have identified one image in each post to be the featured image, which now appears on the main page with the post text around it.
However, I want to use the image as a sprite, so I somehow need to identify the featured image as a background.
First, I put this in the css:
<?php header("Content-type: text/css"); ?>
, immediately after my import files.Then, I wrote:
<?php $attachment-post-thumbnail = get_image(); ?> a.rollover {display:block; width:300px; height:200px; text-decoration:none; background:url("<?php echo $attachment-post-thumbnail;?>");} a.rollover:hover {background-position:-300px 0;}
….and nothing happens. I’m not sure I copied all the relevant code of the sprite, but it works in html, so I am only concerned about the php part.
Can someone help? Thanks.
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘How can I call the featured image of each post to act as a background?’ is closed to new replies.