• kiwair

    (@kiwair)


    Hello,

    I’m currently developing a wordpress theme based on the underscores starter theme. I need to hide many elements of the theme and I’m debating between hiding the element with CSS (display:none) or removing the function call directly in the .php template (removing get_footer(); to hide the footer by example).
    Which one do you think would be considered best practice?

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    if you remove get_footer(), you’ll break your site as get_footer() loads footer.php, which calls wp_footer(), which does all sorts of useful stuff!

    If there are footer elements you don’t want, edit footer.php and remove them.

    Moderator bcworkz

    (@bcworkz)

    Steve is correct, but you can take what he suggests to an extreme by removing everything from footer.php except the wp_footer() call. If you go that far, just call wp_footer() from your main template and not load footer.php at all. Assuming that wp_footer() is indeed the only element actually needed.

    footer.php often has closing tags like </body></html> and sometimes a closing </div> or two — don’t forget to include these on your main template if footer.php is not loaded.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Best practice to hide elements from theme’ is closed to new replies.