Remove automatic excerpts only for single posts

It seems to me that your code runs too early, i.e. before WordPress determined what the queried object is, i.e. whether it’s for a single post, a category archive, a search results page, etc. Such issue could happen if you added the code “just like that” to your theme’s functions file, so try doing it … Read more

Can anyone help me with replace genesis post excerpt with yoast meta description and if there is no meta description show the excerpt?

Remove: add_filter( ‘get_the_excerpt’, ‘replace_post_excerpt_filter’ ); function replace_post_excerpt_filter($output) { return $output; } from your code, and you should find it works. The trouble with nested functions, as you have here, is that once the parent function is called the first time, it defines the inner function, but when the parent function is called the second time … Read more

Limited excerpt with readmore

You can use the default filter for the length of the_excerpt // Changing excerpt length function new_excerpt_length($length) { return 40; } add_filter(‘excerpt_length’, ‘new_excerpt_length’);

Export Posts in excel [closed]

If you have direct access to your WordPress database, you could use a tool like PHPMyAdmin or HeidiSQL to query the post and user tables and extract the information you need from the appropriate tables. I discuss how an SQL query is constructed to get specific categories in Does WordPress Offer A Way to Get … Read more

Excerpt length and alignment [duplicate]

add_filter( ‘excerpt_length’, function($length) { return 400; }, 999 ); add_filter(‘excerpt_more’, function($more) { return ”; }); another edit: this will cut words at the end, not in the middle of some word. I’m sorry if I understood the request wrong. And be free to change 400 to any amount of words you want to show. add … Read more

Return excerpt on Search

you will just do the the_excerpt(); in search loop like this Following is the code that goes in search.php <?php if(have_posts()):while (have_posts()):the_post();?> <a href=”https://wordpress.stackexchange.com/questions/214112/<?php the_permalink(); ?>”> <h3 class=”title-heading”><?php the_title(); ?></h3> <?php the_excerpt(); ?> </a> <?php endwhile; else:”No matching result found”; endif; ?>

Need to show post summary in sidebar

Easy way is use – excerpt() else you can also use wp_trim_words( get_the_content(), 40, ‘…’ ); In a excerpt(), You have to add content on excerpt in backend. While wp_trim_words will trim words from content. In sidebar case you have to add shortcode into functions.php file which uses in sidebar widget(if you are using widgets). … Read more