Site logo

Archived topic

seperate containers for category page

7 replies · Started by Torsten on October 12, 2022

Viewing posts 1–8 of 8

Hi,
I have 2 questions:
1.
I would like to display the category pages without the category name above the posts.

.page-header .author-info>:last-child, .page-header>:last-child {
    display: none;
}

leaves the white body background colour...
check out "News" and Link in "Private Information", white space between header and posts.
2.
I would like to have space between the posts on the category pages, and only there, not on the start page. How can the code below be set for category pages only?

.generate-columns {
    margin-bottom: 20px;
    padding-left: 20px;
}

Can you help?
Thanks ahead,
Torsten

Hi Torsten,

1. You can use this snippet to remove the page-header for category archives:

add_action('wp', function() {	
if (is_category() ) {
    remove_action( 'generate_archive_title', 'generate_archive_title' );
	}
});

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

2. Your CSS can be modified to this:

.archive.category .generate-columns {
    margin-bottom: 20px;
    padding-left: 20px;
}

Hi Ying,
thanks for #1, working fine.
For #2, unfortunately this code doesn't give me the 20px space in background colour #EBE7E0 between the posts on the pages mentioned in "Private information".
Please check again, I left your Code in Custom CSS.
best,
Torsten

Hi Fernando,
find 2 image links in Private information as well as both URLs to the category pages.
Image one (Kuenstlerinnen) shows on the left part the actual state, the right one shows the space in background colour between the posts as wanted.

The effect is the same as setting "Customizer / Layout / Container / seperate Container", shown in the 2nd image which shows the homepage with this setting and the then unwanted spacings, highlighted in light green and with arrows.
I excluded the unimportant middle part of the screenshot (pixeled).

Hope that helps,
best,
Torsten

Hi there,

if you have the site Customizer > Layout > Container set to One Container.
Then you can use this PHP Snippet to set the the Container to Separate Containers for specific template tags eg.


add_filter( 'option_generate_settings','lh_single_posts_settings' );
function lh_single_posts_settings( $options ) {
    if ( !is_single() ) {
        $options['content_layout_setting'] = 'separate-containers';
    } 
    
    return $options;
}

That will set any NON single template ( eg. blog, archives, homepage ) to separate containers.

Hi David,
still not what I wanted to achieve, but with Yings code as a starting point I've now set a box shadow, which works fine for me.

.archive.category .generate-columns {
    padding: 20px;
    box-shadow: 0 8px 8px 0 #ebe7e0;
}

Thanks to Ying, Fernando and David,
best,
Torsten

Glad to hear you found a solution

This archived topic is closed to new replies.