- This topic has 10 replies, 3 voices, and was last updated 6 years, 3 months ago by
Leo.
-
AuthorPosts
-
September 7, 2017 at 12:27 pm #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.
September 7, 2017 at 12:34 pm #381256Leo
StaffCustomer SupportHi 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' ); }
September 7, 2017 at 12:46 pm #381270Max
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; }
September 7, 2017 at 3:45 pm #381355Leo
StaffCustomer SupportTry this:
add_action( 'after_setup_theme','lh_remove_footer' ); function lh_remove_footer() { if ( is_404() ) { remove_action( 'generate_footer','generate_construct_footer' ); } }
September 7, 2017 at 9:45 pm #381438Max
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; }
September 7, 2017 at 10:54 pm #381456Max
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
September 8, 2017 at 12:25 am #381485Tom
Lead DeveloperLead DeveloperThat snippet Leo provided should work – how are you adding the function?
You can always just use CSS:
.error404 .site-footer { display: none; }
September 8, 2017 at 12:45 am #381492Max
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
September 8, 2017 at 8:18 am #381753Leo
StaffCustomer SupportTry this:
.error404 .sidebar { display: none; }
September 8, 2017 at 12:12 pm #381901Max
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
September 8, 2017 at 1:33 pm #381936Leo
StaffCustomer SupportHmm can you link me to a page?
-
AuthorPosts
- You must be logged in to reply to this topic.