I’m still having problems with this. Does anyone have any ideas? I’d very much appreciate it. 🙂
Hi you need to call the catch_that_image function as the source of your image tag, like:
<img src="<?php bloginfo('template_directory'); ?><?php echo catch_that_image() ?>" alt="" />
smrdo,
Thanks for the reply. Can you clarify a little, though? Do I put the code you specified in the template before the call for the excerpt? And is the ‘template directory’ supposed to be the name of my WordPress theme? I’m a little confused. Most of my posts have an image first before the text. But I have the images in an ‘assets’ folder. I did not use the wysiwyg editor in the admin panel to insert them into the post. Does that make sense? Not sure if that makes a difference of where and how it would find and pull that first image.
Thanks again for your help!
Just leave ‘template directory’ as it is, thats a standard reference to your theme, you dont need to edit it.
it shouldnt matter if the images are in an assetts folder,
i tested by instertng an image through the html editor stored in an assetts folder, like
themename/images/assetts/myimage.jpg
as long as the image is in the post it should still be found.
this what i used to show the first image if no feature image was set up, im also using tim thumb to create a thumbnail, but ignore that bit if not needed, you should be able to see i’ve placed the call to ‘catch_that_image’ in a div just before the excerpt, athough you could put it any where in the loop
<div class="thumbTest">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
} else { ?>
<img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo catch_that_image() ?>" alt="" />
<?php } ?>
</div>
<div class="entry-content">
<?php the_excerpt(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-content -->
<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
</div><!-- #post-## -->
hope that helps
Awesome!! Thanks so much! That worked! Just have to adjust my CSS settings to make it all look pretty. I very much appreciate your help!
djlender
no problem, glad it helped