WordPress.org

Ready to get started?Download WordPress

Forums

Properly adding featured image to theme (2 posts)

  1. iadagraca
    Member
    Posted 2 years ago #

    The wordpress theme we're using supported featured images but seemed to use the first image of each post with no prompt to ADD featured image manually. This became a bigger issue when i started using nextgen gallery.

    i want to change that, i've already added featured image to the posting page. but now i need it to work for the theme.

    <div class="container">
        <div class="headergallery">
    	<?php $my_query = new WP_Query('category_name=featured&showposts=3'); ?>
    	<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    		<div class="headergalleryimage">
    			<?php if (get_post_meta($post->ID, "featuredimage", true) != '') { ?>
    			<a href="<?php the_permalink() ?>" title="<?php the_title() ?>">
                <img src="<?php bloginfo('template_url') ?>/timthumb.php?src=<?php echo urlencode(get_post_meta($post->ID, "featuredimage", true)) ?>&w=185&h=185&zc=1" alt="<?php the_title() ?>" />
                </a>
    			<?php } elseif (preg_match('/<img([^>]*)>/i', get_the_content(), $match) != FALSE) {
    				preg_match('/src=([\'"])([^\'"\1]+)\1/i', $match[1], $imagesrc);
    				$url = $imagesrc[2];
    			?>
    			<a href="<?php the_permalink() ?>" title="<?php the_title() ?>">
                <img src="<?php bloginfo('template_url') ?>/timthumb.php?src=<?php echo urlencode($url); ?>&w=185&h=185&zc=1" alt="<?php the_title() ?>" />
                </a>

    That is the section of my header that seems relevant to adding the featured image.

    how can i fix this so that it chooses the featured image I've set for the post?

  2. iadagraca
    Member
    Posted 2 years ago #

    No suggestions?

    I've tried some other medthods it seems like it needs some specific set up...

Topic Closed

This topic has been closed to new replies.

About this Topic