🐞 fix: Clean up coding standards
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Search features for BasicWP theme.
|
* Add a comment to show which template is being used on the current page.
|
||||||
*
|
*
|
||||||
* @package BasicWP
|
* @package BasicWP
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
@@ -37,7 +37,8 @@ class ShowTemplate {
|
|||||||
if ( is_admin() ) {
|
if ( is_admin() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
add_action( 'template_redirect', array( &$this, 'checkTemplate' ), 0 );
|
|
||||||
|
add_action( 'template_redirect', array( &$this, 'checkTemplate' ), 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,74 +49,89 @@ class ShowTemplate {
|
|||||||
public function checkTemplate() {
|
public function checkTemplate() {
|
||||||
if ( is_404() ) {
|
if ( is_404() ) {
|
||||||
$template = get_404_template();
|
$template = get_404_template();
|
||||||
if ( $template ) {
|
|
||||||
|
if ( $template ) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
} elseif ( is_search() ) {
|
} elseif ( is_search() ) {
|
||||||
$template = get_search_template();
|
$template = get_search_template();
|
||||||
if ( $template ) {
|
|
||||||
|
if ( $template ) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
} elseif ( is_tax() ) {
|
} elseif ( is_tax() ) {
|
||||||
$template = get_taxonomy_template();
|
$template = get_taxonomy_template();
|
||||||
if ( $template ) {
|
|
||||||
|
if ( $template ) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
} elseif ( is_home() ) {
|
} elseif ( is_home() ) {
|
||||||
$template = get_home_template();
|
$template = get_home_template();
|
||||||
if ( $template ) {
|
|
||||||
|
if ( $template ) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
} elseif ( is_front_page() ) {
|
} elseif ( is_front_page() ) {
|
||||||
$template = get_front_page_template();
|
$template = get_front_page_template();
|
||||||
if ( $template ) {
|
|
||||||
|
if ( $template ) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
} elseif ( is_attachment() ) {
|
} elseif ( is_attachment() ) {
|
||||||
$template = get_attachment_template();
|
$template = get_attachment_template();
|
||||||
if ( $template ) {
|
|
||||||
|
if ( $template ) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
} elseif ( is_single() ) {
|
} elseif ( is_single() ) {
|
||||||
$template = get_single_template();
|
$template = get_single_template();
|
||||||
if ( $template ) {
|
|
||||||
|
if ( $template ) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
} elseif ( is_page() ) {
|
} elseif ( is_page() ) {
|
||||||
$template = get_page_template();
|
$template = get_page_template();
|
||||||
if ( $template ) {
|
|
||||||
|
if ( $template ) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
} elseif ( is_category() ) {
|
} elseif ( is_category() ) {
|
||||||
$template = get_category_template();
|
$template = get_category_template();
|
||||||
if ( $template ) {
|
|
||||||
|
if ( $template ) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
} elseif ( is_tag() ) {
|
} elseif ( is_tag() ) {
|
||||||
$template = get_tag_template();
|
$template = get_tag_template();
|
||||||
if ( $template ) {
|
|
||||||
|
if ( $template ) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
} elseif ( is_author() ) {
|
} elseif ( is_author() ) {
|
||||||
$template = get_author_template();
|
$template = get_author_template();
|
||||||
if ( $template ) {
|
|
||||||
|
if ( $template ) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
} elseif ( is_date() ) {
|
} elseif ( is_date() ) {
|
||||||
$template = get_date_template();
|
$template = get_date_template();
|
||||||
if ( $template ) {
|
|
||||||
|
if ( $template ) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
} elseif ( is_archive() ) {
|
} elseif ( is_archive() ) {
|
||||||
$template = get_archive_template();
|
$template = get_archive_template();
|
||||||
if ( $template ) {
|
|
||||||
|
if ( $template ) {
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->template = function_exists( 'get_index_template' ) ? get_index_template() : get_template_directory() . '/index.php';
|
$this->template = function_exists( 'get_index_template' ) ? get_index_template() : get_template_directory() . '/index.php';
|
||||||
}
|
}
|
||||||
$this->template = apply_filters( 'template_include', $this->template );
|
|
||||||
// Hook into the footer so we can echo the active template
|
$this->template = apply_filters( 'template_include', $this->template );
|
||||||
|
|
||||||
|
// Hook into the footer so we can echo the active template
|
||||||
add_action( 'wp_footer', array( &$this, 'show_template' ), 100 );
|
add_action( 'wp_footer', array( &$this, 'show_template' ), 100 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user