Archived topic
Text before photo in blog post
4 replies · Started by Tomasz on August 13, 2022
Hi there,
You're using a Block Element to display your Title and Post Meta - Correct ?
You can edit that and insert a GB Headline Block and use its Dynamic data options to display Post Meta and use a custom field.
You just then need to add that custom field to your posts to store your paragraph
Yes, I use the block element as a header for entries and as posts in the category archive.
This solution that you gave me came up with earlier, but it has one drawback for me. It works in the entry, but in the category archive, the character limit does not work, e.g. 15 words to fit in two lines. Like on photos. And I would not like to set the word limit in this heading in the entry to 15 words only as much as I need but then the archive does not work.
[url=https://ibb.co/LxVrV7D][img]https://i.ibb.co/McFfF0y/Schowek01.jpg[/img][/url]
[url=https://ibb.co/tD6nyk1][img]https://i.ibb.co/TtGJzpN/Schowek011.jpg[/img][/url]
Looks like I handled it. I added this PHP code:
add_filter( 'get_the_excerpt', function( $excerpt, $post ) {
if ( has_excerpt( $post ) ) {
$excerpt_length = apply_filters( 'excerpt_length', 15 );
$excerpt_more = apply_filters( 'excerpt_more', ' ' . '[…]' );
$excerpt = wp_trim_words( $excerpt, $excerpt_length, $excerpt_more );
}
return $excerpt;
}, 10, 2 );
Could it possibly be done better somehow?
Ah - ok if you're using the Manual Excerpt then that code you have is required.

