WordPress.org

Ready to get started?Download WordPress

Forums

Excluding the "read more" from specific categories... (2 posts)

  1. iamharlan
    Member
    Posted 4 years ago #

    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?

  2. iamharlan
    Member
    Posted 4 years ago #

    Anyone?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.