Tag Info

New answers tagged

2

This is an alternative to the answer by @tf The manual excerpt set by a user is stored as a WP_Post object, $post_excerpt. post_excerpt string User-defined post excerpt You can access this excerpt inside the loop with $post->post_excerpt You can simply do a check to see if this object is empty or not


5

Try this: if ( has_excerpt( $some_post_id ) ) { // Do something here? } else { // Or here? } References: has_excerpt


1

Though it's a bit of unnecessary things to answer your actual question, but for the fact, I used the following code into many of my News Portal WordPress sites, where I had the facilities to Control the excerpt length, and I changed the excerpt More link to my choice. All I did was using my new function echo nano_excerpt(50) instead of using the_excerpt(). ...


0

If you adding this code in content.php then you should use conditions. <?php if ( is_single() ) : ?> <?php the_content(); ?> <?php else : ?> <?php the_excerpt(); ?> <?php endif; ?>


2

The problem is the difference between the teaser and excerpt which is mistaken one for another in many case. The excerpt_more filter that you are using will change the teaser more text, not the excerpt. The right filter for this is the get_the_excerpt. But it doesn't change the [...] of the excerpt, it gives you the ability to change the excerpt itself. So ...


0

To be really honest here, there is no method in determining a paragraph. Yes, Wordpress has a filter called wpautop that set p tags (paragraphs) based on double line breaks, and that is all that Wordpress defines as a paragraph, a piece of text separated by a double line break from another piece of text. Lets look at the screenshot from the HTML from a ...


0

I have modified the earlier solution to your needs. You need to change following line $wpse0001_excerpt = substr( $wpse0001_excerpt, 0, strpos( $wpse0001_excerpt, '</p>' ) + 4 ); to this $wpse0001_excerpt = explode('</p>', $wpse0001_excerpt, 3); // unset the rest of the contents if(isset($wpse0001_excerpt[3])) ...



Top 50 recent answers are included