Archived topic
How to add other related or recommended articles at end of each article?
19 replies · Started by Paul on June 30, 2022
Hello how are you
i have a issue here and pls guide and explain it, thanks in advance.
now i want to add other recommended articles from the same category at the end of each article, do you give me some ways to achieve this layout?
now im using post navigation from generatepress theme, pls check the screenshot https://prnt.sc/lVDm_vwNXjSR , The key issue is that it just show two articles and they are also from different post categories.
https://prnt.sc/DOcbdFTZ8Wt6
now what i want is
1. Show more articles such as 5 articles
2. show the same articles from the same category
3. The articles displayed can be adjusted manually or automatically by time or other criteria
So, if i just use the tools from generatepress theme, can it be done?
if not, what i should do or use what?
looking forward to hearing from u
thanks
Hi Paul,
I believe the functionality you’re looking for is the ability to query posts.
If so, an option is to use the Query Loop Block from GenerateBlocks free plugin.
See: https://generateblocks.com/generateblocks-1-5-dynamic-data-query-loops-image-blocks/
Also see: https://docs.generateblocks.com/article/query-loop-overview/
Through the Query Loop Block, you should be able to show articles, and choose which articles to show.
Hope this clarifies!
hello
thanks
i will try Query Loop Bloc
i remember that generatepress theme does not have this funciton?
anyway, how to know the update of theme funciton ?
otherwise the users will miss them
Hi Fernando,
I need to insert Query Loop Block at end of each article every time? Or i just insert it once?
Hi Fernando,
can i move the date to the right of heading titile and pls check the sreenshot https://prnt.sc/z_P4ea1GOmow
GeneratePress does not have this function. It was another product we had that has that function. Specifically, WP Show Posts.
Now, WP Show Posts has been merged with our other product, GenerateBlocks.
With regards to your second inquiry, you can add the Query Loop Block through a Block Element and hook it to somewhere like after_content and display it to all posts. This way, you wouldn’t need to add it to every article.
Hope this clarifies!
With regards to your third inquiry, can you try setting the Headline Blocks to inline width in the spacing section of their Block Settings.
Reference: https://docs.generateblocks.com/article/headline-overview/#spacing
Alternatively, you can place them in a Grid Block.
Reference: https://docs.generateblocks.com/article/grid-overview/
Kindly let us know how it goes.
So the i can not move the date to the right of heading title and now also can not use wp show posts plugin.
Try adding them within a Grid Block. Example: https://share.getcloudapp.com/5zurnDrn
You can still use WP Show Posts, it’s just that our team’s focus development-wise would be on GenerateBlocks.
Hope this clarifies!
hi
thans for ur help
i already used Query Loop Block and Element Block to add this to end of each article.
One more thing here, how to exclude itself own article from the recommended articles?
For exmaple: https://prnt.sc/S40721-zFRJ4
You can use a filter to do as such.
Add my-class-name to the Post Template Block as such: https://share.getcloudapp.com/qGuOrgnZ
Then add this PHP snippet:
add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) {
if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'my-class-name' ) !== false ) {
$query_args['post__not_in'] = [get_the_ID()];
}
return $query_args;
}, 10, 2 );
Adding PHP reference: https://docs.generatepress.com/article/adding-php/#code-snippets
Hope this helps!
You can do so in Appearance > Customize > Site Identity.
Reference: https://docs.generatepress.com/article/site-identity-overview/
Hope this clarifies.
hello
yes, right
i do that there
pls check the screenshot https://prnt.sc/tiVWfh7gHgH-
not show site title
where is the problem
It’s there, its color is white though that’s why it seems like it's missing.
You can change the color of the Site Title in Appearance > Customize > Colors > Header > Site Title.
Hope this clarifies!