Mar
24

Excerpt function with conditional tags:

Excerpt function with conditional tags:

I hope you have read the post by Shane about the excerpt in wordpress. That method can be used to bypass the excerpt in the Loop. However, excerpt can be used with some conditional tags in your Loop.

For example, you want excerpt to word only for categories and achieves. Then replaces the_content() tag with the_excerpt() when on archive (tested by is_archive()) or category (is_category()) pages.

<?php if(is_category() || is_archive()) {
the_excerpt();
} else {
the_content();
} ?>

Popularity: 7%

Related posts:
  1. Conditional Tags In Wordpress Hi, These are the Conditional Tags that can be used...
  2. How To Display Post Excerpt In Wordpress Hi, As a wordpress user you may need to show...
  3. How To Split Posts with the More Tags? Wondering how to display first few (selected) words in the...
  4. List Of Post Tags in Wordpress Blog Hi, These are the Post tags which can be used...
  5. How To Set The Limit Of Words In the_excerpt In Wordpress Hi, Many of the wordpress user wants to set the...

Leave a Reply

You must be logged in to post a comment.