[Resolved] Remove footer from 404 page

Home Forums Support [Resolved] Remove footer from 404 page

Home Forums Support Remove footer from 404 page

  • This topic has 10 replies, 3 voices, and was last updated 7 years ago by Leo.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #381246
    Max

    Hey Tom

    I already found your post about removing side bar from 404 page using snippet and 404 conditional.

    Snippet works just fine.

    But how do I remove the footers from the 404 page.

    Thanks in advance for your assistance.

    #381256
    Leo
    Staff
    Customer Support

    Hi there,

    Try this with the same conditional:

    add_action( 'after_setup_theme','tu_remove_footer' );
    function tu_remove_footer() {
        remove_action( 'generate_footer','generate_construct_footer' );
    }
    #381270
    Max

    I ran this, but it did not work:

    add_action( 'after_setup_theme','tu_remove_footer' );
    function tu_remove_footer() {
        
        if ( is_404() )
     	 	
        remove_action( 'generate_footer','generate_construct_footer' );
        
        return $layout;
    }
    #381355
    Leo
    Staff
    Customer Support

    Try this:

    add_action( 'after_setup_theme','lh_remove_footer' );
    function lh_remove_footer() {
        if ( is_404() ) {
            remove_action( 'generate_footer','generate_construct_footer' );
        }
    }
    #381438
    Max

    Nope does not work. Even after clearing cache.

    In any event seems a bit much to have to run two separate snippets in my functionality plugin just to style the 404 page…

    Can these to snippets be combined (the first one does not work) second one does:

    REMOVE 404 FOOTER

    add_action( 'after_setup_theme','lh_remove_footer' );
    function lh_remove_footer() {
        if ( is_404() ) {
            remove_action( 'generate_footer','generate_construct_footer' );
        }
    }

    REMOVE 404 SIDEBAR

    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;
    
     }
    #381456
    Max

    My 404 page is styled and resided in my child theme folder…perhaps that is the reason the remove footer snippet did not work?

    Thanks in advance for your kind assistance.

    Max

    #381485
    Tom
    Lead Developer
    Lead Developer

    That snippet Leo provided should work – how are you adding the function?

    You can always just use CSS:

    .error404 .site-footer {
        display: none;
    }
    #381492
    Max

    Hey Tom

    Thanks for your reply.

    Is there css to also remove the sidebar.

    I can then put everything in my child theme style sheet.

    And to answer your question I was running the above snippets in my functionality plugin

    #381753
    Leo
    Staff
    Customer Support

    Try this:

    .error404 .sidebar {
        display: none;
    }
    #381901
    Max

    Thanks for that.

    .error404 .sidebar {
        display: none;
    }

    only problem is that the page is not full screen (it is when using the snippet).

    What do I need to add to this css to ensure the 404 page is full screen (content no sidebars) ?

    Kind Regards

    Max

    #381936
    Leo
    Staff
    Customer Support

    Hmm can you link me to a page?

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.