Hook for changing excerpt content when excerpt not set

The proper hooks for modifying the post excerpt are the ones you already tried: get_the_excerpt and the_excerpt, and WordPress actually uses the former one to generate an excerpt from the full post content, if there’s no custom or manually-specified excerpt for the post — below is the relevant code in wp-includes/default-filters.php: add_filter( ‘get_the_excerpt’, ‘wp_trim_excerpt’, 10, … Read more

has_excerpt() not working inside wp_query

So we already resolved the issue via the comments, but I thought I should explain something: has_excerpt() returns ! empty( $post->post_excerpt ) if the post has a custom/manual excerpt, so if the function is returning true when it should be false, then it’s likely because the length of the excerpt in the database is > … Read more

adding class to excerpt

the_excerpt() function bascially echo(es) the get_the_excerpt() function output, which in turns wraps the $post->post_excerpt value in html <p> tags. So you can either strip the html markup, <p class=”myclass”><?= wp_strip_all_tags( get_the_excerpt(), true ) ?></p> or, if you have access to the $post object simply, <p class=”myclass”><?= $post->post_excerpt ?></p>

Automatic excerpt is not shown with the_excerpt() command

By default, the_excerpt(), doesn’t uses the post/page content wysiwyg, it has its own textarea, that by default is not visible, you need to enable it first via screen options. After you checked this checkbox you can scroll down to the bottom of the post/page and see a new textarea, this is the excerpt. If you … Read more

the_excerpt is not limiting my post page to 55 words?

Hi @janoChen: Are you sure that code it running and not some other code? I just traced through the code and the only way it’s going to do that is if you have a plugin or code in your theme that is hooking one of the following hooks: ‘the_excerpt’, ‘get_the_excerpt’, ‘wp_trim_excerpt’ or possibly removed the … Read more

Excerpt vs content formatting woes

the_content() and the_excerpt(), unlike their ‘get_’ brothers will process the content through some functions, one of them is wpautop() that will add p tags for you. To get the same formatting for both excerpt and content: if ( has_excerpt() ) { the_excerpt(); } else { the_content(__(‘Read more’)); }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)