Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Custom template for each category (block – content template)

  • I created a template for each category. In it, I use a grid for posts with Content Views Pro. I also have separate widgets for each category that sort posts by ACF. However, the category page duplicates entries using the built-in GeneratePress loop. I tried to disable them with the code below, but it didn’t help.

    PHP

    add_filter( 'generate_do_template_part', function( $do ) { 
        // Checks if the current page being viewed is a category archive page
        if ( is_category() ){
            // Setting $do to 'false' tells GeneratePress NOT TO DISPLAY the default loop
            $do = false;    
        }
        return $do; 
    });
  • Hi there,

    When you say “I created a template for each category”, is the template a PHP template or block based template?

    Can you explain some more about your setup? And please link us to the page in question.

    Let me know 🙂

  • Each category has own block template and custom widgets with filters and custom category tags. https://blog.konspo.eu/kategoria/okna/

  • Hi there,

    I’m not sure how Content Views Pro handles archive templates, but I assume it has an option to disable additional loops in its settings. Have you checked if that option is available?

  • However, if I use only the theme’s built-in query loop, without Content View Pro, posts are still duplicated. The theme settings include options for customizing the appearance of the post archive, and they appear automatically.

  • Is it possible for you to provide a temporary admin login to your site so we can take a closer look?

  • I’ve successfully set up my archive using the **GenerateBlocks Query Loop** (Block Archive Card) after removing the old content view, and it’s working well.

    However, I’m now experiencing a common issue when using **FacetWP** for filtering:

    1. When I **check** one or more filtering options in the sidebar (FacetWP), the results list correctly filters down.
    2. The problem occurs when I **uncheck** the filter options to return to a larger set of posts. The two-column grid layout is **lost**, and all posts are displayed in a single column, stacked one above the other.

    This issue seems to be related to how the **AJAX refresh** of the FacetWP template interacts with the **CSS Grid/Flex** structure applied by GenerateBlocks (or GeneratePress) on the post list. The necessary column classes (e.g., grid-50 or GenerateBlocks grid classes) are not being correctly re-applied or re-initialized after the AJAX reload.

    You can see the issue live here: https://blog.konspo.eu/kategoria/okna/

    Could you please advise on the recommended method or a JavaScript hook to ensure the two-column grid layout remains intact after a FacetWP AJAX operation?

    Thank you for your help!

  • Hi there,

    The posts in the page you linked are not created via GB’s query block. Am I missing anything?

    If you’ve done the change, can you make sure all cache is cleared? I’m probably seeing the cached version.

    This is what I see: https://app.screencast.com/yXLqsxw318dwT

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