• Resolved iamharlan

    (@iamharlan)


    Now here’s one that probably hasn’t been asked before.
    I run a multi-author blog that consists of several different types of articles. I am hoping to introduce a new weekly links post to the content, but I want the post to ignore the excerpt length requirements. Essentially, I want everything to be excerpted (if that’s a word) and this post to show in its entirety every week. Is this possible?

    I though about maybe introducing a new category and creating a code that would call the content if it was in this category, but only the excerpt if it was in any other category. I think that will work, but alas, I am fairly new to php.

    Any help would be greatly appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You could do that with a category, a tag or a custom meta field. The category is probably the easiest.

    Thread Starter iamharlan

    (@iamharlan)

    Yeah, that’s what I figured. But like I said, I’m still fairly new to php and wordpress tags. Can you give an example of the code that would make this possible?

    Find your Loop, then find the the_excerpt function, and replace that with a switch like this one.

    if (in_category('myspecialcat')) {
     global $more;
     $more = 1;
     the_content();
    } else the_excerpt();
    Thread Starter iamharlan

    (@iamharlan)

    That worked perfectly. I was actually working with a truncated post instead of an excerpt, but it worked all the same. Thanks!

    Thread Starter iamharlan

    (@iamharlan)

    Hey guys…sorry to open this back up…but I’m wanting to do this again, but this time add an additional category to the mix. Basically, if it is in the “links” or “pages” category…I want the full post. Otherwise, I’d like the post to stay truncated.

    The current code I have in there is…

    <?php if (in_category('links')) {
                      global $more;
                      $more = 1;
                      the_content();
                      } else truncate_post(410, ""); ?>

    I’ve tried it a couple of ways, but what keeps happening is I get duplications of the truncated portions. I’m sure it’s something really simple, but my brain is wracked trying to figure it out.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘One post exception to excerpt length…’ is closed to new replies.