wordpress help...
- Started
- Last post
- 7 Responses
- effour
Hi,
This code is displaying all images in the post, not just the one declared in the 'extra field'
<img src="<?php echo get_post_meta($post->ID, 'preview_image',true) ?>" alt="Featured Project" class="preview png_bg" />
Any advice on how I can make sure it only displays that one declared 'preview_image'
Thanks,
R
- blaw0
Can you add a class to the other images within that block element? If so, use CSS to set display: none; for the images you don't want to appear.
- effour0
i can manually add a class, to images in the post, that could work...i'll give it a try...thx
- acescence0
if you hide them with css, will they not still load making your pages really heavy?
anyway, are you sure you're getting all the images from your preview snippet and not within the text of the post itself? if you have inline images in a post, you have to strip them out of your text if you're doing your own excerpt a la the response i gave in that other thread. check out the php function strip_tags
- effour0
It's weird beacause should it not just pull the extra fields 'preview_image' image?
I don't understand why it is pulling all images from the post. Am I missing something?
<img src="<?php echo get_post_meta($post->ID, 'preview_image',true) ?>" alt="Featured Project" class="preview png_bg" />
- JamesBoynton0
http://wordpress.org/extend/plug…
not great at wp but this pulls and resizes the first image in the post no matter whether its top or bottom.
- ya, no workie...thx anywayeffour
- did you change the_content to the_excerpt?JamesBoynton
- effour0
There must be a way to stop this code from loading other images...so bizarre it would do that...
<img src="<?php echo get_post_meta($post->ID, 'preview_image',true) ?>" alt="Featured Project" class="preview png_bg" />