• Hi all,

    I’m trying to modify my index.php, so when I add a text for the excerpt (the_excerpt), it will display it on my homepage but if I did not place any text, it will instead display the content (the_content) instead of the default first 55 words.

    So far this is what I have but it’s not working..

    <?php if (function_exists('the_excerpt')) { the_excerpt( );} else {the_content();} ?>

    Any help will be aprpeciated.

    Thanks,

    Abiel

Viewing 2 replies - 1 through 2 (of 2 total)
  • is that in the loop?

    if yes, try:

    <?php if( $post->post_excerpt ) { the_excerpt(); } else { the_content(); } ?>

    Thread Starter Abiel

    (@aabuy)

    Yes, it’s in a loop..

    I tried the code and it works like a charm!

    Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Conditional for the_excerpt and the_content’ is closed to new replies.