Make WordPress Core

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#18985 closed enhancement (fixed)

twentyeleven_setup should use get_template_directory() instead of __FILE__

Reported by: tomauger's profile TomAuger Owned by: nacin's profile nacin
Milestone: 3.3 Priority: normal
Severity: minor Version: 3.2.1
Component: Bundled Theme Keywords:
Focuses: Cc:


Since this is a pluggable function, which would be over-ridden in the child theme's directory, and since we want to make it as easy as possible for new developers to extend the parent theme, consider

require( get_template_directory() . '/inc/theme-options.php' );
require( get_template_directory() . '/inc/widgets.php' );

instead of using

require( __FILE__ . '/inc/theme-options.php' );
require( __FILE__ . '/inc/widgets.php' );

FILE breaks the theme and throws errors the moment twentyeleven_setup is defined somewhere within the child theme's directory structure, whereas get_template_directory() will always point to TwentyEleven.

Change History (4)

#1 @knutsp
13 years ago

  • Cc knut@… added

#2 @lancewillett
13 years ago

+1 for this change.

#3 @nacin
12 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [19289]:

Use get_template_directory() for include paths in Twenty Eleven, rather than FILE magic constant. Won't go stale when twentyeleven_setup() is overridden. props TomAuger, fixes #18985.

#4 @nacin
12 years ago

  • Milestone changed from Awaiting Review to 3.3
Note: See TracTickets for help on using tickets.