Archived topic
dynamic content of latest 3 blog posts
4 replies · Started by Jeroen on March 9, 2021
Hi
With the new dynamic options, is it possible to design a container with a grid of three, in which to display the title, featured image and (part of content) of the latest post? And 'hook' it before the footer on only the front page for example? I assume it's possible but can't find the correct elements.
Similar to your existing block for displaying the latest blog posts, but then with freedom for own design?
Jeroen
Hi Jeroen,
Unfortuanly the dynamic content doesn't include the latest posts option.
For now you could use WP show posts and some CSS to achieve this :)
Ok thanks, maybe later
No problem :)
Hi Jeroen
You can actually do this with a little bit of code. Firstly you need to create a hook with a query & loop (https://generatewp.com/wp_query/ works well).
Then within the loop you can add a custom function, eg. do_action('featured_news_posts');
After that, you can create a block element with dynamic features that targets a custom hook: featured_news_posts
This way you can have a custom design made in Generateblocks without having to do much coding. I find it much easier to maintain doing it this way than writing the HTML/CSS manually.
Limitations... By default it creates a list so if you had 3 posts and wanted them in columns then you need to add use some CSS to achieve it.
To the GeneratePress team, this would be a really cool featured to have whether as GeneratePress or as WP Show Posts. Perhaps an element that provides the query arguments similar to WP Show Posts but also has a block element that provides the content.