• Resy

    (@selectedbymila)


    Hi there,

    Currently I am trying to set up the query loop in the template for my posts. Within the query loop you can select one or more categories via the taxonomies. That is clear to me. However, ideally I want that when I view a post, I only see the other articles from the same parent category.

    So for example I have a post within my category Productivity, then at the end of the post I want to see 3 articles that are also from the Productivity category and not from the Time Management category. And when I go to a post from the Career category, I want to see other articles from the Career category and not from Productivity. This query loop I want to include within the template, so I can avoid that I need to add this to the post itself everytime I create a new one.

    Is there a way to set this up? I am no expert in coding – not at all… Hopefully someone can help me with this. Thanks in advance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Can you share the code your currently have in the template?

    Thread Starter Resy

    (@selectedbymila)

    Thanks for the quick reply!

    I don’t use a code, I use the native “query loop” block within FSE.

    thank you

    Thread Starter Resy

    (@selectedbymila)

    It just occurred to me that I can of course see the code via the code editor (via appearance > editor > templates > [the template in which I use the query loop]). This is it:

    <!-- wp:query {"queryId":16,"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false},"displayLayout":{"type":"flex","columns":3},"layout":{"type":"constrained"}} -->
    
    <div class="wp-block-query"><!-- wp:post-template -->
    
    <!-- wp:post-featured-image {"isLink":true} /-->
    
    <!-- wp:post-date {"style":{"typography":{"fontSize":"11px"}}} /-->
    
    <!-- wp:post-title {"isLink":true,"style":{"spacing":{"margin":{"top":"0px","right":"0px","bottom":"0px","left":"0px"}}}} /-->
    
    <!-- /wp:post-template --></div>
    
    <!-- /wp:query --></div>
    Thread Starter Resy

    (@selectedbymila)

    Is there anyone from support who can help with this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Query loop: showing same category as current post’ is closed to new replies.