[Support request] About 404 page

Home Forums Support [Support request] About 404 page

Home Forums Support About 404 page

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #582361
    John

    Hello

    I don’t Want sidebar for 404 error pages.

    How can I do this?

    By default, SHowing Search and Archive.

    #582507
    David
    Staff
    Customer Support

    Hi Mamun

    you can remove the sidebar from the 404 with this snippet:

    add_filter( 'generate_sidebar_layout','tu_custom_search_sidebar_layout' );
    function tu_custom_search_sidebar_layout( $layout )
    {
     	// If we are viewing 404 message, set the sidebar
     	if ( is_404() )
     	 	return 'no-sidebar';
    
     	// Or else, set the regular layout
     	return $layout;
    
     }

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

    Or you can use this CSS:

    .error404 .sidebar {
        display: none;
    }
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.