1

I am working with a theme I inherited that has been poorly coded.

The category view was displaying a horrible default youtube missing video picture at the top of each post snippet originally. I edited cateogry.php to this, and now the category view is working:

<?php
/**
 * The template for displaying Category Archive pages.
 *
 * @package WordPress
 * @subpackage zelop
 */

get_header(); ?>

        <section class="main">

        <?php if( is_category( of_get_option('video_blog') ) ) : ?>

                     <h1 class="page-title"><?php
                      echo single_cat_title( '', false );
                  ?></h1>   

                  <?php get_template_part( 'loop', 'archive' ); ?>


        <?php else : ?>     

                  <h1 class="page-title"><?php
                      echo single_cat_title( '', false );
                  ?></h1>   

                  <?php get_template_part( 'loop', 'archive' ); ?>


         <?php endif; ?>       


        </section><!--end of main-->

        <?php get_sidebar(); ?>

    </section>

<?php get_footer(); ?>

However when the category page is displayed there is no photos appearing at the top of each snippet.

I would like the featured image of each post, to appear in the categories view, above the snippet, what code can I add to the category.php so that featured images for each post, are shown above the post snippet?

thanks

1 Answer 1

1

What you are looking for is the_post_thumbnail();.

You should do something like this:

<?php if ( has_post_thumbnail() ) : ?>
    <?php the_post_thumbnail(); ?>
<?php endif; ?>

More information can be found here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.