Site logo

Archived topic

How to add other related or recommended articles at end of each article?

19 replies · Started by Paul on June 30, 2022

Viewing posts 1–15 of 20

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

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?

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!

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!

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!

This archived topic is closed to new replies.