WordPress.org

Support

Support » Themes and Templates » Excluding the “read more” from specific categories…

Excluding the “read more” from specific categories…

  • I posted a topic a while back about a one category exception to a rule on the homepage of my blog. Well…the point was that I wanted to show a whole post for a specific category, and the truncated post for all other categories. I was successful with this code:

    <?php if (in_category('pages')) {
                      global $more;
                      $more = 1;
                      the_content();
                      } else truncate_post(410, ""); ?>
    
                    <a href="<?php the_permalink() ?>" rel="bookmark" class="readmore" title="Permanent Link to <?php the_title(); ?>">
        read more
        </a>

    Now…because I am showing the whole post on the category “pages”, I have no need to have the “readmore” link on those posts. Conversely, I do want to keep the readmore for the posts that have been truncated.

    So my question is, how do I include the absence of the “readmore” link from the “pages” category, but have it function as usual for all other categories? Should I create another if/else, or can I simply include it in the existing code somehow?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Excluding the “read more” from specific categories…’ is closed to new replies.