[Resolved] footer disappeared

Home Forums Support [Resolved] footer disappeared

Home Forums Support footer disappeared

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #2031970
    Ewa

    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?

    #2032061
    Leo
    Staff
    Customer Support

    Hi 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-element

    If that doesn’t help then try disabling all plugins and custom functions except for GP Premium to test

    #2032325
    Ewa

    Hello 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?

    #2032362
    Leo
    Staff
    Customer Support

    I can’t see how that would be the issue as it has nothing to do with the footer.

    How are you adding the code?

    #2032389
    Ewa

    I 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

    #2032399
    Ying
    Staff
    Customer Support

    The snippet has nothing to do with the footer.

    Can you try disable all plugins except GP Premium and Code snippet to test?

    #2033198
    Ewa

    I 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?

    #2033260
    David
    Staff
    Customer Support

    Hi there,

    the category archive you linked to has the Loop removed – is that what you added that snippet for ?

    #2033510
    Ewa

    Hello David,

    yes exactly. The aim was to remove the posts loop because I want to add them by myself (using different layout)

    #2034222
    David
    Staff
    Customer Support

    Try this function instead:

    add_filter( 'generate_do_template_part', function( $do ) {
        if ( is_category( '54' ) ) {
            return false;
        }
        return $do;
    } );
    #2034562
    Ewa

    David, thank you very much. This code works perfectly – removes the posts loop but keeps the footer.
    Thanks a lot!

    #2035456
    David
    Staff
    Customer Support
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.