WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] IF excerpt THEN use it ELSE use content? (3 posts)

  1. mhains
    Member
    Posted 6 years ago #

    Can someone throw some code my way?

    I'm trying to display the posts on my main page a different way depending on whether or not there's an excerpt.

    I've been using the_excerpt_reloaded but if it encounters an excerpt, it's not adding the "more" link.

    So I'm hoping you can help.

    Here's how I need it to go:

    IF excerpt THEN
    use it
    ELSE
    use content
    END IF

    Hope you can help,
    Michael

  2. mhains
    Member
    Posted 6 years ago #

    Found myself a solution. Category 10 is my "Features" category:

    <?php if ( in_category('10') ){ ?>
    
       <?php the_excerpt(); ?><a href="<?php the_permalink(); ?>"><small>Full Story</small></a>
    
    <?php } else { ?>
    
       <?php the_excerpt_reloaded(100, '<a><small><blockquote><br><strong><img>','content',TRUE, '<small>Full Story</small>',TRUE,2,TRUE); ?>
    
    <?php } ?>
  3. DianeV
    Member
    Posted 6 years ago #

    Pretty cool stuff. Thanks, mhains.

Topic Closed

This topic has been closed to new replies.

About this Topic