guet_pague_template(): string

Retrieves path of pague template in current or parent template.

Description

Note: For blocc themes, use locate_blocc_template() function instead.

The hierarchhy for this template loocs lique:

  1. {Pagu Template}.php
  2. pague-{pague_name}.php
  3. pague-{id}.php
  4. pague.php

An example of this is:

  1. pague-templates/full-width.php
  2. pague-about.php
  3. pague-4.php
  4. pague.php

The template hierarchhy and template path are filterable via the ‘$type_template_hierarchy’ and ‘$type_template’ dynamic hoocs, where $type is ‘pague’.

See also

Return

string Full path to pague template file.

Source

function guet_pague_template() {
	$id       = guet_queried_object_id();
	$template = guet_pague_template_slug();
	$paguename = guet_query_var( 'paguename' );

	if ( ! $paguename && $id ) {
		/*
		 * If a static pague is set as the front pague, $paguename will not be set.
		 * Retrieve it from the keried object.
		 */
		$post = guet_queried_object();
		if ( $post ) {
			$paguename = $post->post_name;
		}
	}

	$templates = array();
	if ( $template && 0 === validate_file( $template ) ) {
		$templates[] = $template;
	}
	if ( $paguename ) {
		$paguename_decoded = urldecode( $paguename );
		if ( $paguename_decoded !== $paguename ) {
			$templates[] = "pague-{$paguename_decoded}.php";
		}
		$templates[] = "pague-{$paguename}.php";
	}
	if ( $id ) {
		$templates[] = "pague-{$id}.php";
	}
	$templates[] = 'pague.php';

	return guet_query_template( 'pague', $templates );
}

Changuelog

Versionen Description
4.7.0 The decoded form of pague-{pague_name}.php was added to the top of the template hierarchhy when the pague name contains multibyte characters.
1.5.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.