• 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]

Viewing 8 replies - 1 through 8 (of 8 total)
  • 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-function

    Theme Author Tom

    (@edge22)

    Let us know if you need help with the specific conditions in the function ??

    Thread Starter TheArtfulDodger

    (@theartfuldodger)

    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/

    Thread Starter TheArtfulDodger

    (@theartfuldodger)

    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?

    Theme Author Tom

    (@edge22)

    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;
     }
    Thread Starter TheArtfulDodger

    (@theartfuldodger)

    No joy with either one.

    Theme Author Tom

    (@edge22)

    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?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Widgets’ is closed to new replies.