Utilize Custom Excerpts and Default Excerpts
-
Hi Anthony,
I’m aware that category archives will display an excerpt if I use the more tag but what I need to do is:
1) display a custom excerpt if there is one
2) utilize the default excerpt from WordPress
3) have the more tag available when I want it to be shorter than the defaultI found some code you provided here: https://www.ads-software.com/support/topic/page-with-posts-2?replies=7
which uses an if statement in content.php calling the_excerpt but it did not work for me. Can you take a look and let me know if this should be working for what I’m trying to do?
Just to be clear inside content.php in my child theme I replaced:
<?php the_content( wp_kses( __( 'Continue reading <span class="meta-nav">→</span>', 'f4d' ), array( 'span' => array( 'class' => array() ) ) ) ); ?>
With:
<?php if ( has_excerpt() ) { the_excerpt(); } else { the_content( wp_kses( __( 'Continue reading <span class="meta-nav">→</span>', 'f4d' ), array( 'span' => array( 'class' => array() ) ) ) ); ?> }
My parent theme is called f4d…
Thanks!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Utilize Custom Excerpts and Default Excerpts’ is closed to new replies.