[wp-trac] [WordPress Trac] #31475: Add ability to change the folder location for templates
WordPress Trac
noreply at wordpress.org
Thu Mar 5 23:24:16 UTC 2015
#31475: Add ability to change the folder location for templates
-------------------------+------------------------------
Reporter: rugbert | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: 4.1
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+------------------------------
Comment (by rugbert):
Corrected some code (it doesn't look like we can edit our posts here)
Moved the constant path check conditional out of the loop, and fixed a
fata error in the same conditional.
>
>
> {{{
> function locate_template($template_names, $load = false, $require_once =
true ) {
> $located = '';
> $path = '';
> if( defined('WP_TEMPLATE_DIRECTORY')
> && !is_null(WP_TEMPLATE_DIRECTORY)
> && file_exists( STYLESHEETPATH . '/' .
WP_TEMPLATE_DIRECTORY) ){
>
> $path = WP_TEMPLATE_DIRECTORY. '/';
> }
>
> foreach ( (array) $template_names as $template_name ) {
> if ( !$template_name )
> continue;
>
> if ( file_exists(STYLESHEETPATH . '/' . $path .
$template_name)) {
> $located = STYLESHEETPATH . '/' . $path .
$template_name;
> break;
> } else if ( file_exists(TEMPLATEPATH . '/' . $path .
$template_name) ) {
> $located = TEMPLATEPATH . '/' . $path .
$template_name;
> break;
> }
> }
>
> if ( $load && '' != $located )
> load_template( $located, $require_once );
>
> return $located;
> }
> }}}
>
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31475#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list