[Support request] Columns only on homepage

Home Forums Support [Support request] Columns only on homepage

Home Forums Support Columns only on homepage

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

    Hello GP team,

    have layout of the blog set to 3 columns. I only want to show columns on the homepage, not in the archive, categories and tags. Is there a matching CSS command.

    Thanks for your help …

    Greetings Uwe

    #746870
    David
    Staff
    Customer Support

    Hi their,

    you can use the blog options filter:

    https://docs.generatepress.com/article/option_generate_blog_settings/

    instead of the is_search() you can target the is_archive()

    #747045
    Anonymous

    Hi David,

    Thank you for your prompt reply. Can not do it unfortunately – do not know me in PHP, etc. not. Is there not a way that I can solve that with “Adding CSS”.

    Thanks for a tip

    Greetings Uwe

    #747091
    Leo
    Staff
    Customer Support

    Not possible with CSS.

    Try this PHP snippet:

    add_filter( 'option_generate_blog_settings', 'lh_disable_columns' );
    function lh_disable_columns( $options ) {
        if ( ! is_home() ) {
    	$options['column_layout'] = false;
        }
        return $options;
    }

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

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