WordPress.org

Make WordPress Core

Opened 20 months ago

Closed 19 months ago

Last modified 19 months ago

#18985 closed enhancement (fixed)

twentyeleven_setup should use get_template_directory() instead of __FILE__

Reported by: TomAuger Owned by: nacin
Priority: normal Milestone: 3.3
Component: Bundled Theme Version: 3.2.1
Severity: minor Keywords:
Cc: knut@…

Description

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)

comment:1 knutsp20 months ago

  • Cc knut@… added

comment:2 lancewillett20 months ago

+1 for this change.

comment:3 nacin19 months 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.

comment:4 nacin19 months ago

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