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.

Change of archive layout for a specific category

  • Hi,

    I created a page some month ago which stores one picture per “WordPress Post”. All posts will be listed in category archives. And for this kind of posts I optimized my layout.
    Now I ran into the following issue: I want to create “normal” posts with text, all the posts will be stored in the category “aktuelles”. All the posts of the category “aktuelles” should be displayed without the 4 columns layout.

    Is there a possibility to change the behaviour just for a specific category? Maybe with an own “category-aktuelles.php” file?

    Thank you!

    Best regards,
    Nico

  • Hi there,

    what is the changes you want to make to the aktuelles category archive?

  • Hi,

    I want to change the layout to one or two columns and I want to show at least the title of the blog post.

    Best regards,
    Nico

  • For the columns you can use the generate_blog_get_column_count filter hook:

    https://docs.generatepress.com/article/using-columns-in-the-blog/#changing-the-number-of-columns

    for example:

    
    add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
    function tu_search_column_count( $count ) {
        if ( is_category('your-category-slug') ) {
            return 50;
        }
    
        return $count;
    }
    

    This will set the column width to 50% ( 2 columns ) for the slug you set in the condition: if ( is_category('your-category-slug') ) {

    For the title, how are you currently removing that from your other archives ?

  • Thank you, I will try your suggestions.

    The last question regarding the title. I was wrong, I do not remove titles. The title formatting is just broken – for sure because of my changes I already did.
    For now, I have no questions.

    Best regards,
    Nico

  • You’re welcome

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