WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9421 closed defect (bug) (invalid)

Globals in footer.php

Reported by: enailor Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: Themes Keywords: reporter-feedback
Focuses: Cc:

Description

For some reason, globals and typical WP functions do not seem to be working in theme footer.php files.

Setting a variable to global seems to permit calling that variable anywhere with exception of the footer.php file in which the variable is lost. This also applies to the is_front_page() function which does not work in the footer. (I have not tested other WP functions to know which ones do and do not work in footer)

In the forums, one suggestion is that global variables need to be redeclared as global and they will work. However, I am unaware of any way to redeclare the WP functions so that they will also work in the footer.

Variables and functions should be available in the footer as well.

Change History (6)

comment:1 DD325 years ago

  • Keywords reporter-feedback added; footer.php variables functions removed
  • Priority changed from high to normal
  • Severity changed from major to normal

I see no reason it wouldnt.

Disabled all plugins and tried with the default theme?

I'm thinking it could be a widget is resetting the $wp_query resulting in those template functions not working

comment:2 hakre5 years ago

Can not reproduce. This Bugreport seems bogus, looks like the reporter is having invalid source-code. maybe an unclosed function body?

comment:3 enailor5 years ago

Doing more research, I have found that it is other $wp-query calls that are messing this up. However, that being given, how does one reset the Wordpress functions? If one must correct plugins and themes to work around this, there are a number of plugins and themes that will require reworking.

comment:4 DD325 years ago

try calling wp_reset_query() and see if that fixes it.

comment:5 Denis-de-Bernardy5 years ago

  • Resolution set to invalid
  • Status changed from new to closed

comment:6 Denis-de-Bernardy5 years ago

  • Milestone Unassigned deleted
Note: See TracTickets for help on using tickets.