Site logo

Archived topic

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

4 replies · Started by Bodie on April 4, 2018

Viewing posts 1–5 of 5

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?

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 :)

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

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

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' );
    }
}
This archived topic is closed to new replies.