Forums

[resolved] Display content in one category and excerpt in all others (3 posts)

  1. sebastianz
    Member
    Posted 2 years ago #

    Hi all,

    I've seen a couple of other posts on this topic, but the solutions didn't work for me. My website has a photography category for which I want to display the full content in the archive; for the other categories, I just want to display the excerpts. I tried if statements like:

    <?php if (in_category( 'Photography' )): the_content(); else: the_excerpt(); ?>

    ... but I get unexpected T_ENDWHILE or in other attempts, it displays the excerpts and the full posts, or neither.

    I assume part of the problem is because the IF is inside a WHILE loop (and because I don't really know what I'm doing). Here is the full code of the archive page:

    http://wordpress.pastebin.com/m733cf

    Any help would be appreciated. Thanks!

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Looks like you should be able to replace

    <?php the_excerpt(); ?>

    with

    <?php if (in_category( 'Photography' )) {
    the_content();
    }else{
    the_excerpt();
    }
    ?>
  3. sebastianz
    Member
    Posted 2 years ago #

    Hey, that worked! Thanks a lot!

Topic Closed

This topic has been closed to new replies.

About this Topic