﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
15061,Allow either array or string to be passed to locate_template,chrisbliss18,scribu,"Currently, template file names have to be passed as an array to the locate_template function:

{{{
locate_template(array('category-new.php', 'category.php'));
}}}

Passing in multiple template file names is a very powerful feature; however, outside of core, most code simply needs to locate a single template file name. As can be seen from this variety of locate_template calls made in BuddyPress:

{{{
locate_template( array( 'members/single/activity.php' ), true );
locate_template( array( 'members/single/messages.php' ), true );
locate_template( array( 'members/single/profile/edit.php' ), true );
locate_template( array( 'members/members-loop.php' ), true );
locate_template( array( 'activity/activity-loop.php' ), true );
locate_template( array( 'groups/single/forum.php' ), true );
locate_template( array( 'sidebar.php' ), true );
locate_template( array( 'groups/single/group-header.php' ), true );
}}}

Note that this is just a very small sampling. In total, locate_template is used 89 times in BuddyPress, and not once is more than a single file passed to locate_template.

My attached patch makes working with locate_template much easier for general usage by allowing either a string or array for the $template_names argument. A string argument will be changed into an array.",enhancement,closed,normal,3.1,Template,,minor,fixed,has-patch dev-reviewed,gaarai@…
