[Resolved] Custom Columns Layouts for Categories

Home Forums Support [Resolved] Custom Columns Layouts for Categories

Home Forums Support Custom Columns Layouts for Categories

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1632433
    Anonymous

    Hello,

    I have two blog post categories and I would like to have custom column layouts for each of the categories.
    The podcast category has 3 columns which was easy to set up through the customizer.
    Now I would like the blog category to remain centered without any columns.

    I have looked through the forum but somehow I could not make it work.
    Maybe because I am confused what to enable or disable in the customizer when adding a php code.
    Any ideas?

    Podcast Category:

    View post on imgur.com

    How I would like the blog category to look:

    View post on imgur.com

    Thanks!

    #1632542
    David
    Staff
    Customer Support

    Hi there,

    you can do it with some CSS:

    .category-blog .generate-columns-container .post {
        width: 100%;
    }
    #1632569
    Anonymous

    Hello David,

    thank you very much! It worked like a charm.

    I also added this php snippet from Tom to make sure that the sidebars for this specific category are enabled:

    add_filter( 'generate_sidebar_layout','generate_custom_category_sidebar_layout' );
    function generate_custom_category_sidebar_layout( $layout )
    {
     	// If we are on a category, set the sidebar
     	if ( is_category( 'Blog' ) )
     	 	return 'both-sidebars';
    	
     	// Or else, set the regular layout
     	return $layout;
    }
    #1632638
    David
    Staff
    Customer Support

    Glad to be of help 🙂

    As a note – you can use the Layout Element to make changes like sidebars etc.

    https://docs.generatepress.com/article/layout-element-overview/

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