WordPress.org

Ready to get started?Download WordPress

Forums

Themes without wp_footer -- workaround? (3 posts)

  1. micropat
    Member
    Posted 5 years ago #

    Many themes out there still do not contain this simple (and required) line: <?php wp_footer(); ?>

    From a plugin developing standpoint I'm looking to code in a workaround for this. So two questions:

    What would be a decent way to detect the lack of wp_footer?

    Would there be a way to still output code before the </body> tag?

    Thanks!

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    a) Don't bump around here. We hate that.

    b) Only way to detect such a thing is to open the theme's footer.php file as a text file, read it in, and search for the text in it.

    c) You probably don't want to detect this. Too much overhead. Instead, just tell your users to add the line to their theme if it's not there.

    d) All themes here on WordPress.org should have that. Recommend them.

  3. micropat
    Member
    Posted 5 years ago #

    Recommending properly-coded Themes and offering instructions on how to add that footer tag is what we're doing, but this is still a very persistent problem unfortunately. Linking to the WP.org Theme Directory is a good idea.

    You're right on the overhead, which is why we're hoping for some decent (and clever) way to detect this. At this point it doesn't seem that there is a good workaround to these poorly coded themes.

    I think to help combat such themes, it'd be awesome if the Theme preview would additionally scan and warn of a theme that doesn't have the required tags, etc. -- before activation.

Topic Closed

This topic has been closed to new replies.

About this Topic