[Resolved] set theme option by page , slug etc.

Home Forums Support [Resolved] set theme option by page , slug etc.

Home Forums Support set theme option by page , slug etc.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #598713
    sg

    Hi there,

    i am using other plugin to create custom post types. whenever i edit the page, the theme option setings such as sidebar[no sidebar ] and page title [hide] BACK to default value.

    i am sure there is way to fix this . force setting it to fix a value.?

    sample url such as /directory/business , /directory/business/details etc

    GeneratePress 2.1.2
    GP Premium 1.6.2
    #598908
    David
    Staff
    Customer Support

    Hi there,

    you can use some filters to do this, first Sidebars:

    add_filter( 'generate_sidebar_layout', 'gp_custom_post_sidebar_layout' );
    function gp_custom_post_sidebar_layout( $layout ) {
        $post_types = array( 'slug-1', '​slug-2', 'slug-3' );
    
        if ( in_array( get_post_type(), $post_types ) ) {
            return 'no-sidebar';
        }
    
        return $layout;
    }

    And we can try this for the title:

    add_filter( 'generate_show_title','gp_cpt_remove_title' );
    function gp_cpt_remove_title( $title ) {
        $post_types = array( 'slug-1', '​slug-2', 'slug-3' );
        
        if ( in_array( get_post_type(), $post_types ) ) {
            return false;
        }
    
        return $title;
    }

    Let me know

    #600106
    sg

    thanks.

    #600115
    David
    Staff
    Customer Support

    You’re welcome. Glad to be of help

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