- This topic has 11 replies, 4 voices, and was last updated 2 years, 4 months ago by David.
-
AuthorPosts
-
November 30, 2021 at 10:05 am #2031970Ewa
Hello,
I have the following issue. Footer has gone from my blog archive pages. Few days ago it was there but now – I don’t know why it totally disappeared.
Could you help me identify why that happened?November 30, 2021 at 11:16 am #2032061LeoStaffCustomer SupportHi there,
The only built-in method to disable the entire footer in the archive and blog pages is to use a layout element:
https://docs.generatepress.com/article/layout-element-overview/
https://docs.generatepress.com/article/layout-element-overview/#disable-elementIf that doesn’t help then try disabling all plugins and custom functions except for GP Premium to test
November 30, 2021 at 2:41 pm #2032325EwaHello Leo,
thank you. I have idenified the problem which was a following code snippet:
add_action( ‘pre_get_posts’, function( $query ) {
if ( !is_admin() && $query->is_main_query() ) {
$query->set( ‘cat’, -54 );
}
} );I added it to hide posts from specific category and it worked but at the same time it removed the footer from archive pages.
Do you know any other method to get the result whicg is hiding posts from a specific archive category?
November 30, 2021 at 3:22 pm #2032362LeoStaffCustomer SupportI can’t see how that would be the issue as it has nothing to do with the footer.
How are you adding the code?
November 30, 2021 at 3:46 pm #2032389EwaI have added it via code snippet plugin. It is definitively the reason, because if I disable this particular snippet (not the plugin) the footer turns up
November 30, 2021 at 3:59 pm #2032399YingStaffCustomer SupportThe snippet has nothing to do with the footer.
Can you try disable all plugins except GP Premium and Code snippet to test?
December 1, 2021 at 6:24 am #2033198EwaI do understand, but that is exactly what I did. First I disabled all the plugins to check one by one which one is causing the problem. Finally when I enabled all plugins again except for Code Snippets plugin and the footer came back.
Then I enabled the code snippets plugin (the footer has gone) and then disabled the particular snippet:add_action( ‘pre_get_posts’, function( $query ) {
if ( !is_admin() && $query->is_main_query() ) {
$query->set( ‘cat’, -54 );
}
} );and the footer appeared again so it has nothing left what could cause the problem like the abive mentioned code.
Do you think I could change it somehow to get the same result but without harming the footer?
December 1, 2021 at 7:09 am #2033260DavidStaffCustomer SupportHi there,
the category archive you linked to has the Loop removed – is that what you added that snippet for ?
December 1, 2021 at 7:54 am #2033510EwaHello David,
yes exactly. The aim was to remove the posts loop because I want to add them by myself (using different layout)
December 1, 2021 at 11:24 am #2034222DavidStaffCustomer SupportTry this function instead:
add_filter( 'generate_do_template_part', function( $do ) { if ( is_category( '54' ) ) { return false; } return $do; } );
December 1, 2021 at 1:51 pm #2034562EwaDavid, thank you very much. This code works perfectly – removes the posts loop but keeps the footer.
Thanks a lot!December 2, 2021 at 3:27 am #2035456DavidStaffCustomer SupportGlad to hear that
-
AuthorPosts
- You must be logged in to reply to this topic.