Archived topic
Removing Sidebar in Lifter LSM quizes
9 replies · Started by Endre on October 28, 2018
Hello!
I am trying to get rid of the side bar in quizes in LifterLMS plugin.
Could you help? Thanks. 🙂
Hi there,
First thing to check is to see if the post type shows up in Display Rule of Layout Element:
https://docs.generatepress.com/article/layout-element-overview/
If so that will be the easiest way.
If not then you can try using the filter:
https://docs.generatepress.com/article/sidebar-layout/#using-a-function
But you will need to know the exact tag for the quiz page (might need to check with their support).
We could probably try CSS as well but I'll need to see the quiz page if you can link me to it.
Thanks. I downloaded Code Snippets, used the filter, found their custom post name and did it for the side bar. How can I do it to get rid of the footer?
This snippet should remove the footer:
add_action( 'after_setup_theme','tu_remove_footer' );
function tu_remove_footer() {
remove_action( 'generate_footer','generate_construct_footer' );
}
You will need to add the same conditional tag of course.
I'm not a coder. Could you please include the whole code here? Mine looked like this:
add_filter( 'generate_sidebar_layout', 'km_custom_post_sidebar_layout' );
function km_custom_post_sidebar_layout( $layout ) {
$post_types = array( 'llms_quiz' );
if ( in_array( get_post_type(), $post_types ) ) {
return 'no-sidebar';
}
return $layout;
}
Thanks. :)
Try this:
add_action( 'after_setup_theme','tu_remove_footer' );
function tu_remove_footer() {
$post_types = array( ‘llms_quiz’ );
if ( in_array( get_post_type(), $post_types ) ) {
remove_action( 'generate_footer','generate_construct_footer' );
}
}
Unfortunately I doesn't do it. :( I also realized I should remove the header and primary menu, so if you could help me in any of these, I'd be greatly appreciated...
Do you have a lot of pages where you will want primary menu etc?
On a second thought, would it be easier to create a layout element to disable those things:
https://docs.generatepress.com/article/layout-element-overview/#disable-element
In Display Rule, choose Entire Site, then add the pages you want those elements into the Exclusion?
https://docs.generatepress.com/article/layout-element-overview/#display-rules
Let me know :)
Suddenly it works now, perhaps they changed something at Lifter. Thank you for your help.
No problem :)