[Support request] how to create related posts with generateblocks?

Home Forums Support [Support request] how to create related posts with generateblocks?

Home Forums Support how to create related posts with generateblocks?

Viewing 15 posts - 1 through 15 (of 28 total)
  • Author
    Posts
  • #2285382
    eran

    Hi, how can i make related posts in the right sidebar that when im in a page the sidebar will show all the brothers page of the page?
    plus, if im in the parent page i want to display all the child pages.

    is it possible with generateblocks?

    #2285541
    Fernando
    Customer Support

    Hi Eran,

    It can be achieved through a Query Loop Block from GenerateBlocks 1.5.4 and GB Pro 1.3.0.

    Reference: https://docs.generateblocks.com/article/query-loop-overview/

    Otherwise, you’ll need custom code to achieve as such through GB.

    Hope this clarifies!

    #2285598
    eran

    I understand.
    But I don’t know how to achieve it.
    What should I chhose in the parameters?

    #2285605
    Fernando
    Customer Support

    You can try Taxonomies > Categories > Current Post terms. Example: https://share.getcloudapp.com/Z4uApkjw

    Hope this clarifies!

    #2285606
    eran

    But I don’t use categories on my menu i use pages. it will still work?

    #2285614
    Fernando
    Customer Support

    You’re right, it wouldn’t work.

    Try Parent > Current Post to show all Child pages: https://share.getcloudapp.com/6quzweGg

    Then, to get all siblings, add my-query to the Grid Block of the Query Loop, and add this PHP snippet:

    add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) {
    		if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'my-query' ) !== false ) {
    			global $post;
    			$query_args['post_parent'] = $post->post_parent;
    		}
    
    		return $query_args;
    	}, 10, 2 );

    Adding PHP reference: https://docs.generatepress.com/article/adding-php/#code-snippets

    Kindly let us know how it goes.

    #2285618
    eran

    I need to add “my-query” to the grid block as a class?

    #2285620
    Fernando
    Customer Support

    Yes, that’s correct. Example: https://share.getcloudapp.com/kpu8Rbeq

    #2286155
    eran

    I dont have the option for current post.
    I try to make this through generatepress elements.

    #2286169
    David
    Staff
    Customer Support

    Hi there,

    if you want to display the Child pages, then the Parameter is: Parent -> Current Post

    See here:

    https://generateblocks.com/creating-related-posts-with-query-loop-block/

    Check the Index of child pages example

    NOTE: This is a GenerateBlocks Pro feature and requires version 1.30 which is in Alpha:

    https://generateblocks.com/generateblocks-pro-1-3-0/

    #2286342
    eran

    Yes I have the generateblocks pro Version 1.5.4
    I dont have the option current post.
    I can choose a single page but i want this to apply on all the pages.

    #2286345
    David
    Staff
    Customer Support

    GenerateBlocks Pro is only up to version 1.3

    https://generateblocks.com/generateblocks-pro-1-3-0/

    Its a separate plugin.

    Version 1.5.4 is the free version.

    #2286350
    eran

    oh now I see.
    why I didnt get a message for the update?
    every update I need to download the update from the generateblocks website?

    #2286360
    David
    Staff
    Customer Support

    In the GenerateBlock settings, you need to have your license key added and saved and the Receive beta updates toggle enabled if you want to see the alpha/beta updates.

    #2286362
    eran

    I update for 1.3 version
    its still doesnt work.

Viewing 15 posts - 1 through 15 (of 28 total)
  • You must be logged in to reply to this topic.