[Resolved] Container style only in blog

Home Forums Support [Resolved] Container style only in blog

Home Forums Support Container style only in blog

  • This topic has 16 replies, 3 voices, and was last updated 7 years ago by Tom.
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #298965
    Rafael

    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

    #298973
    Leo
    Staff
    Customer Support
    #299035
    Rafael

    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

    #299164
    Leo
    Staff
    Customer Support
    #299477
    Rafael

    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

    #299483
    Rafael

    Did it using custom CSS:

    .masonry-post .inside-article {
    background: #FFFFFF;
    }

    Is there a native way to do it?

    #299513
    Tom
    Lead Developer
    Lead Developer

    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;
    }
    #299564
    Rafael

    Tom,

    It deconfigured all my web page ๐Ÿ™

    Regards,
    Rafael

    #299616
    Tom
    Lead Developer
    Lead Developer

    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?

    #300044
    Rafael

    Yep… i did :P.

    But, when i add both it continue deconfigurated.

    #300098
    Leo
    Staff
    Customer Support

    You don’t want to add both, only the code Tom provided.

    How are you adding the code?

    Let us know.

    #300101
    Rafael

    I am adding it inside functions.php …
    Added each one separed and both together. None worked.

    #300104
    Leo
    Staff
    Customer Support

    Can you try adding Tom’s code only using this method?
    https://docs.generatepress.com/article/adding-php/#code-snippets

    #300217
    Tom
    Lead Developer
    Lead Developer

    Is the code working for you, Leo? Seems to be working for me really nicely.

    #300748
    Tom
    Lead Developer
    Lead Developer

    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;
    }
Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.