Server : Apache System : Linux server.lienzindia.com 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64 User : plutus ( 1007) PHP Version : 7.4.33 Disable Function : NONE Directory : /home/plutus/public_html/wp-content/themes/vrm/inc/theme-builder/ |
Upload File : |
<?php namespace TotalTheme\Theme_Builder; use TotalTheme\Theme_Builder; \defined( 'ABSPATH' ) || exit; /** * Get template ID based on theme location. */ class Location_Template { /** * Template to return for specific location. */ public $template = 0; /** * Start things. */ public final function __construct( $location ) { if ( \method_exists( $this, $location ) ) { $this->$location(); } /** * Filters the location template ID. * * @param int $template_id */ // @todo deprecate and add new "totaltheme/theme_builder/{$location}/template_id" filter. $this->template = (int) \apply_filters( "wpex_{$location}_template_id", $this->template ); } /*-------------------------------------------------------------------------------*/ /* [ Main Locations ] /*-------------------------------------------------------------------------------*/ /** * Single template. */ protected function single() { if ( \is_404() ) { return; // this is used for Elementor only. } $this->template = Post_Template::get_template_id(); } /** * Archive template. */ protected function archive() { if ( \is_search() ) { $this->search_archive_template(); // search must be first because it can return true for \is_tax() if ( ! empty( $this->template ) ) { return; // fixes issues with wpex_is_blog_query when adding ?post= param to the search query. } } if ( \is_tax() ) { $this->taxonomy_archive_template(); } if ( \is_post_type_archive() ) { $this->post_type_archive_template(); } if ( \is_author() ) { $this->author_archive_template(); if ( ! empty( $this->template ) ) { return; // prevent the blog template to take over. } } if ( \wpex_is_blog_query() ) { $this->blog_template(); } if ( \function_exists( 'is_woocommerce' ) && \is_woocommerce() && ( \is_archive() || \is_shop() ) ) { $this->woo_archive_template(); // check WooCommerce last so if you are using the term based template plugin it still works. } } /*-------------------------------------------------------------------------------*/ /* [ Sub Locations ] /*-------------------------------------------------------------------------------*/ /** * WooCommerce archive template. */ protected function woo_archive_template() { $template = \get_theme_mod( 'woo_archive_template_id' ); /** * Filters the woocommerce archive template ID. * * @param int $template_id */ $this->template = (int) \apply_filters( 'wpex_woocommerce_archive_template_id', $template ); } /** * Taxonomy template. */ protected function taxonomy_archive_template() { $template = ''; $taxonomy = \get_query_var( 'taxonomy' ); if ( \is_tax( [ 'staff_category', 'staff_tag' ] ) ) { $template = \get_theme_mod( 'staff_archive_template_id' ); } if ( \is_tax( [ 'portfolio_category', 'portfolio_tag' ] ) ) { $template = \get_theme_mod( 'portfolio_archive_template_id' ); } if ( \is_tax( [ 'testimonials_category', 'testimonials_tag' ] ) ) { $template = \get_theme_mod( 'testimonials_archive_template_id' ); } // Check theme mod defined template if ( empty( $template ) ) { $template = \get_theme_mod( $taxonomy . '_template_id' ); } // Check Post Types Unlimited Template (last) if ( WPEX_PTU_ACTIVE ) { $ptu_check = \wpex_get_ptu_tax_mod( $taxonomy, 'template_id' ); if ( $ptu_check ) { $template = $ptu_check; } } /** * Filters the taxonomy archive template ID. * * @param int $template_id * @param string $taxonomy */ $this->template = (int) \apply_filters( 'wpex_taxonomy_template_id', $template, $taxonomy ); } /** * Author archive template. */ protected function author_archive_template() { $template = \get_theme_mod( 'author_archive_template_id' ); /** * Filters the author archive template ID. * * @param int $template_id */ $this->template = (int) \apply_filters( 'wpex_author_archive_template_id', $template ); } /** * Blog template. */ protected function blog_template() { $template = \get_theme_mod( 'blog_archive_template_id' ); if ( empty( $template ) && \is_tax( 'post_series' ) && \get_theme_mod( 'post_series_enable', true ) ) { $template = \get_theme_mod( 'post_series_template_id' ); } /** * Filters the blog archive template ID. * * @param int $template_id */ $this->template = (int) \apply_filters( 'wpex_blog_archive_template_id', $template ); } /** * Search template. */ protected function search_archive_template() { $template = \get_theme_mod( 'search_archive_template_id' ); /** * Filters the search archive template ID. * * @param int $template_id */ $this->template = (int) \apply_filters( 'wpex_search_archive_template_id', $template ); } /** * Post Type archive template. */ protected function post_type_archive_template() { $post_type = \get_query_var( 'post_type' ); // Check theme mod defined template $template = \get_theme_mod( "{$post_type}_archive_template_id" ); // Check Post Types Unlimited Template (last) if ( \WPEX_PTU_ACTIVE ) { $ptu_check = \wpex_get_ptu_type_mod( $post_type, 'archive_template_id' ); if ( $ptu_check ) { $template = $ptu_check; } } /** * Filters the post type archive template ID. * * @param int $template_id */ $this->template = (int) \apply_filters( 'wpex_post_type_archive_template_id', $template, $post_type ); } }