[Support request] Hiding Header, Footer & Sidebar on non-editable Post Type?

Home Forums Support [Support request] Hiding Header, Footer & Sidebar on non-editable Post Type?

Home Forums Support Hiding Header, Footer & Sidebar on non-editable Post Type?

  • This topic has 4 replies, 2 voices, and was last updated 6 years ago by Leo.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #541318
    Bodie

    I am using LifterLMS and it generates a post type “Quiz”, that I cannot access via the WordPress Dashboard (I get the “Sorry, you are not allowed to edit posts in this post type” error message).

    I don’t really care about editing it, I just want to embed it in a lightbox, and hide the header, footer and sidebar. I can get it to work fine, but it has the header, footer and sidebars and looks cluttered. Is there a way to hide those for just the quiz post type?

    #541498
    Leo
    Staff
    Customer Support

    Hi there,

    Can you try this snippet for sidebar and see if it works?

    add_filter( 'generate_sidebar_layout','lh_quiz_sidebar_layout' );
    function lh_quiz_sidebar_layout( $layout ) {
        if ( is_post_type_archive( 'quiz' ) ) {
            return return 'no-sidebar';
        }
        return $layout;
    }

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

    Let me know if it works and I can provide the rest of the code 🙂

    #542084
    Bodie

    Thanks for responding!

    Actually, I was able to remove the sidebar with Beaver Themer and I just need the header and footer please! Thanks, Leo

    #542169
    Bodie

    Ok, I still need help! Ha ha

    I tried:

    add_action( 'after_setup_theme','bq_remove_header_on_quizzes' );
    function bq_remove_header_on_quizzes() {
        if (is_singular('quiz')) {
            remove_action( 'generate_header','generate_construct_header' );
        }
    }

    …but it did not work. Thanks for the assistance, Leo

    #542250
    Leo
    Staff
    Customer Support

    Is it a CPT?

    What about this?

    add_action( 'after_setup_theme','bq_remove_header_on_quizzes' );
    function bq_remove_header_on_quizzes() {
        if ( is_post_type_archive( 'quiz' ) ) {
            remove_action( 'generate_header','generate_construct_header' );
        }
    }
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.