Widgets
-
I have a courses page which shows the course images for 4 courses. This was recently updated from 3 courses.
Now i cannot remove the archive and search widgets from below the course images. I have tried everything. (changed the layout to full width- no sidebars, added widgets to replace the meta widgets).
Nothing works. Help!The page I need help with: [log in to see the link]
-
Hi there,
Changing the content layout to No Sidebar should definitely work.
I see that it’s an archive page so you will need to use filter:
https://docs.generatepress.com/article/sidebar-layout/#using-a-functionLet us know if you need help with the specific conditions in the function 🙂
I don’t quite understand why this is an archive page. It is the page which people go to to see the course choices, then they select the appropriate course.
It is not a page which is going to change historically so I can’t understand how this has happened.
Any help would be greatly appreciated.Looks like the plugin you are using made it an archive page.
add_filter( 'generate_sidebar_layout','tu_custom_category_sidebar_layout' ); function tu_custom_category_sidebar_layout( $layout ) { if ( is_archive() ) return 'no-sidebar'; // Or else, set the regular layout return $layout; }Adding PHP: https://docs.generatepress.com/article/adding-php/
I used code snippets to add the php code you provided.
Is there a refresh delay on updating the page?
So far it is not working.
I have done a debug of the sidebar and it shows as “sidebar 1”
and it reads “always show”Do I need to remove this?
It should be instant. Try this instead:
add_filter( 'generate_sidebar_layout', 'tu_custom_cpt_sidebar_layout' ); function tu_custom_cpt_sidebar_layout( $layout ) { if ( is_post_type_archive( 'course' ) ) { return 'no-sidebar'; } // Or else, set the regular layout return $layout; }No joy with either one.
Then it’s likely the post type you’re using is using a different page template isn’t of the GP template. Which plugin are you using?
The topic ‘Widgets’ is closed to new replies.
