Archived topic
Creating a new blog look
1 reply · Started by Anders Nielsen on March 28, 2021
Hi there
watching this video, I decided to re-create my custom blog design - inside the new generatepress.
https://www.youtube.com/watch?v=-ZTQP_KA2xE&t=758s
But:
1. How can I create a featured post, on top on all blog posts (on the blog page) (see link)
2. Is there a way for making the filters, and filter on category or tags? (see link)
(please notice the filter uses # and not ? in the url - this is for seo reasons)
3. is there a way to add reading time to the blogpost, shown on the blog page?
I have this code, but I don't know how to activate it on the posts on the blogpage.
function tu_estimated_reading_time() {
$post = get_post();
$content = $post->post_content;
$wpm = 300; // How many words per minute.
$clean_content = strip_shortcodes( $content );
$clean_content = strip_tags( $clean_content );
$word_count = str_word_count( $clean_content );
$time = ceil( $word_count / $wpm );
if ($time == 1) {
return $time . ' minute';
} else {
return $time . ' minutes';
}
}
add_action( 'generate_before_entry_title', function() {
echo tu_estimated_reading_time();
} );
Hi there,
1. If you have Columns enabled in Customizer > Layout > Blog - you can still set the: Make first post featured option.
In addition to this, in the Block Element > Content template Apply to you can set this to First Post. So you can create a Block Element for all your Posts ( lets call that global), then create a new Block Element applied to the First post, and set its Parent to Global...
2. Not at this time, you would need a plugin or custom development to add filters to the loop.
3. You can change that code for a shorcode version - see here:
https://generatepress.com/forums/topic/need-some-help-in-designing-header/#post-1048699
The GB Headline Block supports shortcodes.