Site logo

Archived topic

CSS or PHP Function to Remove Footer + Copyright Bar on Mobile?

3 replies · Started by Andres on July 20, 2020

Viewing posts 1–4 of 4

Hello,

Is it better to use CSS or a php function to remove the footer + copyright bar on mobile? Which one results in a page with fewer assets loading and better performance?

I'm currently using this CSS to disable the footer and copyright in mobile:

@media (max-width: 768px) {
    .site-footer {
        display: none;
    }
}

For performance on mobile, is it better to use a function like the one below from post-1344401?

add_action( 'wp', function() {
    if ( wp_is_mobile() && is_user_logged_in() ) {
        remove_action( 'generate_footer', 'generate_construct_footer_widgets', 5 );
        remove_action( 'generate_footer', 'generate_construct_footer', 10 );
    }
} );

Thank you and have a good day.

Cheers!

Andrés

Hi there,

PHP is generally better when it can be used.

I doubt you will see much difference here though if you run your site through speed test for both solutions :)

Hi Leo,

Thank you!

Andrés

No problem :)

This archived topic is closed to new replies.