function get_query_template( $type, $templates = array() {}

Retrieve path to a template
Used to quickly retrieve the path of a template without including the file extension. It will also check the parent theme, if the file exists, with the use of locate_template(). Allows for more generic template location without the use of the other get_*_template() functions.


  • string $type: Filename without extension.
  • array $templates: An optional list of template candidates

Return values

returns:Full path to file.

Source code

function get_query_template( $type, $templates = array() ) {

	$type = preg_replace( '|[^a-z0-9-]+|', '', $type );

	if ( empty( $templates ) )

		$templates = array("{$type}.php");


No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: