WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Featured Image is active, but thumbnails do not show up in Category archives (4 posts)

  1. thepaisleyfish
    Member
    Posted 1 year ago #

    Hi, I'm new to wordpress and php is quite confusing for me, so be gentle.

    I am using the theme San Kloud and originally it did not support featured image, but I added

    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 80, 55, true ); // W x H, hard crop

    in the functions.php file.
    This made featured images available, yay, but I want a thumbnail of my featured image to be shown with the post summery for my category archive pages.
    I have googled my face off trying to figure this out, but I need help.

    Any suggestions?!

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    to show a featured image, use <?php the_post_thumbnail(); ?> in the corresponding template (category.php?)

    http://codex.wordpress.org/Post_Thumbnails
    http://codex.wordpress.org/Function_Reference/the_post_thumbnail

  3. thepaisleyfish
    Member
    Posted 1 year ago #

    Thanks for the reply.

    I do understand that
    <?php the_post_thumbnail(); ?>
    is the code I'm supposed to use, but I don't know where to put it. San Kloud does not have a category.php

    I tried putting it in the archive.php, but where ever I stick it, the thumbnail is outside of the post content box in my category archive page.

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

    If i stick the thumbnail code above this code, the thumbnail is above the post.
    If I stick the thumbnail below the code, the thumbnail is below the code.

    Does that mean I need to put the thumbnail is the template.php or content.php? and where? Help please!

  4. thepaisleyfish
    Member
    Posted 1 year ago #

    Ahh I figured it out.

    It went in the content-archive.php

    the snippet of code now looks like this:

    <div class="page-title">
    <h2>
    " title="<?php printf( esc_attr__( 'Permalink to %s', 'san-kloud' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
    </h2>
    </div>
    <?php the_post_thumbnail(); ?>
    <?php the_excerpt(); ?>`

    Thanks for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic