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 Archive Page – Everything shows twice

  • I’m trying to design archive-pages for different categories. I created an element (block – content template). To display a single category I set it to blog, post-category-archive, my-category.

    In the element-option on the right I set it to content-template, tag-name:article, apply-to:post-with-term, taxonomy:category, term-name:my-category.

    Problem #1: whenever I add anything to design the look of the page everything shows twice, no matter if I insert a dynamic content, a loop or a template element. I have tried everything that came to my mind, but nothing worked out. I didn’t find anything about this in the forum, so please help me with it.

    Problem #2: I need to remove the category-title that is automatically displayed on the top, I want to replace it with a custom title and a paragraph.

    It should look like this which I made without gp:
    https://seifenwissen.org/thema/seifenfakten/

    Thanks for you help
    Wolfgang

  • Hi Wolfgang,

    For reference, can you provide admin login credentials so we can take a closer look at your setup?

  • Hi Fernando,

    I include it in the private information section. As you may see inbetween I did a workaround with single pages, unfortunately this does not help for the automatically generated category-pages that are linked e.g. from the breadcrumbs.

  • I see. The way you’re using the Content Template is the issue.

    This article has a video showing how to use it correctly: https://docs.generatepress.com/article/block-element-content-template/

    Can you try how it’s done through the video first and see how it goes?

    For the Title, you can use a Block Element – Page Hero: https://docs.generatepress.com/article/block-element-page-hero/

  • Okay, thank you! I did the hook (see attached link) and I can style the top of the page. Now, please help me how to style the category-excerpts beneath. I would like to have a design with three columns for this page.

  • Styling how Posts appear would be where the Block Element – Content Template would help.

    As for the columns, would this be the only category page that would show post in three columns?

  • There are different category-page-designs, three, two and one columns. I made the content template, link attached. What do I need to insert there – if I insert anything it again shows twice… (as there are two posts in the category)

  • To change the number of columns for this category page, add this snippet:

    add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
    function tu_search_column_count( $count ) {
        if ( is_category(24) ) {
            return 33;
        }
    
        return $count;
    }

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

  • I added this to the functions.php, unfortunately it changes nothing.

    What should I add in the content template?

  • The video here shows what to add: https://docs.generatepress.com/article/block-element-content-template/

    Can you set that up first and then, let’s address the columns afterward?

  • Okay, seems to work now. If I apply the column-options are in customizer-layout-blog it looks fine. But I cannot use this option because I don’t want all the archive-pages to be in a three columns design.

  • Okay, seems to work now. If I apply the column-options in customizer-layout-blog it looks fine. But I cannot use this option because I don’t want all the archive-pages to be in a three columns design.

  • Hi there,

    it requires two filters:

    
    add_filter( 'generate_blog_columns', function( $columns ) {
        if ( is_category(24)  && ! is_singular() ) {
            return true;
        }
    
        return $columns;
    } );
    
    add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
    function tu_search_column_count( $count ) {
        if ( is_category(24) ) {
            return 33;
        }
    
        return $count;
    }

    Just update the 24 to the ID of the category you want to apply it to.

  • Hi David, thank you – unfortunately it doesn’t work. When I copy it to the functions.php and want to save it, I cannot, ’cause it says there’s an error in the second line line of your script “unexpected if”. Can you have a look please?

  • I am so sorry, i have updated the code above to fix that error.

  • Perfect! Thanks a lot, David!

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