• I have used the code:

    <div class=”post-text”>
    <?php the_excerpt() ?>
    </div><!– .post-text –>

    On my category.php file but I want to only show the excert on my category called “covid” on the other category pages I want to show the full text for the post.

    Please can you advise how I can show the full text on other categories.

    This was previous code <?php /* show content of current post */
    the_content( __( ‘Continue reading <span class=”meta-nav”>→</span>’, ‘central’ ) );
    /* show link pages of current post */
    wp_link_pages( array( ‘before’ => ‘<div class=”page-link”><span>’ . __( ‘Pages:’, ‘central’ ) . ‘</span>’, ‘after’ => ‘</div>’ ) );
    /* show “edit” link */
    edit_post_link( __( ‘Edit post’, ‘central’ ), ‘<span class=”edit-link”>’, ‘</span>’ ); ?>

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Copy category.php to category-covid.php and you will have separated them, to treat differently. The specific template is used if it matches, and the generic one is used otherwise.
    But that only applies to the separate pages containing all one category.
    Your link to “latest-news” seems to be a mixture, so you would need to check the category before calling the_excerpt() or the_content().
    You can see some code examples on https://developer.www.ads-software.com/reference/functions/get_the_category/

Viewing 1 replies (of 1 total)
  • The topic ‘Only show Excerpt on certain categories’ is closed to new replies.