Related post not showing table of content
Related post not showing table of content
Related post not showing table of content
How to make force_balance_tags balance comment tag
Ok, I found a solution. I’ve found the filter excerpt_more that is used to show the string shown within the more link (if theme use standard WP functions). So, to achieve this, we need to hook the excerpt_more and use a lower priority of the one used by the theme. In my example, this add_filter(‘the_title’, … Read more
Looking at the documentation for the get_the_excerpt filter, we can see that it receives the WP_Post object representing either the current post or the post which was passed in to the get_the_excerpt() function call. Thus, function q_excerpt_custom( $excerpt, $post ) { if ( get_post_type( $post ) == ‘post’ ) : $excerpt_custom = ‘<a class=”card-permalink” href=”‘ … Read more
After a couple hours of debugging, here is what I figured out: The unfortunately-named wp_trim_excerpt() does not merely trim the excerpt passed to it, but also assembles an excerpt if a blank string is passed in. (Yes, I see now that this is in the documentation, but I was grep’ing through code trying to trace … Read more
why does an empty get_the_excerpt change get_the_ID to default homepage?
I get the impression that on some PHP script/page, to be duplicated and modified somewhere in my child theme, the_content should be changed to the_excerpt. This is correct. You can refer to the Template Hierarchy to determine which template file your parent theme is using for the Posts page. Then you can copy that to … Read more
“Continue reading” not on some posts, full excerpts not shown
How to add text before post_excerpt in Gutenberg
At first glance, this appears to be an XY Problem. If you simply want to increase the length of the excerpt auto-generated from the post content, you can use the excerpt_length hook in functions.php. function modify_excerpt_length( $length ) { return 300; } add_filter( ‘excerpt_length’, ‘modify_excerpt_length’, 99 ); Then simply call the excerpt in your template: … Read more