Properly adding featured image to theme
-
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?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Properly adding featured image to theme’ is closed to new replies.