Archived topic
Container style only in blog
16 replies · Started by Rafael on March 29, 2017
Hello
Is there a way to have separate container only in blog page? I want all other pages using one container for content, but in my blog i want separate container with mansonry.
Regards,
Rafael
Hi Rafael,
This should help: https://generatepress.com/forums/topic/separate-containers-just-in-the-blog-page/
Let me know.
Hello Leo,
Didn't work. I just want blog page using separated containers, and with this code all other pages instead blog are being separated.
Any idea?
Regards,
Rafael
Actually give this code a shot:
https://generatepress.com/forums/topic/different-layouts-to-post-and-pages/#post-292183
Let me know :)
Good Leo, almost there...
Now, all posts preview are without white background. Do you know what i have to do?
Take a look... www2.nuvic.com.br/blog
Regards,
Rafael
Did it using custom CSS:
.masonry-post .inside-article {
background: #FFFFFF;
}
Is there a native way to do it?
Hmm, seems the above method has some drawbacks.
Just did some research, and found a way better method.
Try this:
add_filter( 'pre_option_generate_settings','tu_dynamic_container_type' );
function tu_dynamic_container_type( $options ) {
if ( is_front_page() ) {
$options[ 'content_layout_setting' ] = 'separate-containers';
}
return $options;
}
Tom,
It deconfigured all my web page :(
Regards,
Rafael
Hmm, not sure how that's possible - tested it and it worked perfectly.
How did you add it? Did you also remove the old code you added?
Yep... i did :P.
But, when i add both it continue deconfigurated.
You don't want to add both, only the code Tom provided.
How are you adding the code?
Let us know.
I am adding it inside functions.php ...
Added each one separed and both together. None worked.
Can you try adding Tom's code only using this method?
https://docs.generatepress.com/article/adding-php/#code-snippets
Is the code working for you, Leo? Seems to be working for me really nicely.
How about this instead?:
add_filter( 'option_generate_settings','tu_dynamic_container_type' );
function tu_dynamic_container_type( $options ) {
if ( is_front_page() ) {
$options[ 'content_layout_setting' ] = 'separate-containers';
}
return $options;
}