function zgm_flexible_content() { global $post; global $postid; global $pagetemplateclass; global $template; $postid = $post->ID; // get the global post and set the post id for use in get field calls and get_the_title() $template = explode('.', basename(get_page_template()))[0]; // get template base name minus extension $pagetemplateclass = ''; // set default for section class $showAlways = false; // set default for always show based on pre-existing setup incase felx content isnt set $gracefull = true; // check if the flexible content field has rows of data ob_start(); if (have_rows('page_builder', $postid)) { $gracefull = false; // loop through the rows of data while (have_rows('page_builder', $postid)) { the_row(); // locate and insert templates for layouts locate_template('templates/flexible/' . get_row_layout() . '.php', true, false); } } ob_end_flush(); // end flex content }
public function gllr_template_redirect() { global $wp_query; $post_type = get_post_type(); $file_exists_flag = false; $rb_plugin_path = ELM_RBWS_PLUGIN_PATH . '/templates'; $rb_theme_path = STYLESHEETPATH . '/elm-templates'; if ('gallery' == $post_type && "" == $wp_query->query_vars["s"] && !isset($wp_query->query_vars["gallery_categories"])) { if (file_exists($rb_theme_path . '/gallery-single-template.php')) { $full_path = $rb_theme_path . '/gallery-single-template.php'; } else { $full_path = $rb_plugin_path . '/gallery-single-template.php'; } $include_flag = true; } elseif ('gallery' == $post_type && isset($wp_query->query_vars["gallery_categories"]) || basename(get_page_template()) == 'gallery-template.php') { if (file_exists($rb_theme_path . '/gallery-template.php')) { $full_path = $rb_theme_path . '/gallery-template.php'; } else { $full_path = $rb_plugin_path . '/gallery-template.php'; } $include_flag = true; } if ($include_flag) { include $full_path; exit; } }
function incir_body_class() { $classes = get_body_class(); if (is_front_page()) { $template = basename(get_page_template()); switch ($template) { case 'page-front-1.php': $classes[] = 'home-1'; break; case 'page-front-2.php': $classes[] = 'home-2'; break; case 'page-front-3.php': $classes[] = 'home-3'; break; case 'page.php': $classes[] = 'home-1'; break; case 'index.php': $classes[] = 'home-1'; break; } } $classes = implode(' ', $classes); return $classes; }
/** * Before main content * * @since eVision Corporate 1.0.0 * * @param null * @return null * */ function evision_corporate_front_page() { if ('posts' == get_option('show_on_front')) { include get_home_template(); } elseif (1 != evision_corporate_if_all_disable()) { include get_page_template(); } else { /*home banner section*/ do_action('evision_corporate_action_front_slider'); /*about section*/ do_action('evision_corporate_action_front_about'); /*service section*/ do_action('evision_corporate_action_front_service'); /*portfolio section*/ do_action('evision_corporate_action_front_portfolio'); /*client section*/ do_action('evision_corporate_action_front_client'); /*testimonial section*/ do_action('evision_corporate_action_front_testimonial'); /*blog section*/ do_action('evision_corporate_action_front_blog'); /*team section*/ do_action('evision_corporate_action_front_team'); /*map section*/ do_action('evision_corporate_action_front_map'); /*contact section*/ do_action('evision_corporate_action_front_contact'); } }
public function __construct($filename = null) { $this->template_file = $filename; $this->layout = new \Dovetail\Core\Layout(); if (is_Admin()) { /** * If we are actually editing the page this template belongs to. */ if ($this->template_file !== null && get_page_template($this->template_file) == get_page_template()) { // Remove Editor add_action('admin_init', array($this, 'remove_editor')); // Add Layout builder add_action('edit_form_after_title', array($this, 'layout_builder')); // Layout builder enquue add_action('admin_enqueue_scripts', array($this, 'layout_scripts')); add_action('admin_print_scripts', array($this, 'layout_print_scripts')); } } else { // Filters add_filter('wp_title', array($this, 'wp_title'), 10, 2); // Add a more descriptive title // Render this page $this->render(); } }
function getWpTemplate() { if (defined('WP_USE_THEMES') && WP_USE_THEMES) { $template = false; if (is_404() && ($template = get_404_template())) { } elseif (is_search() && ($template = get_search_template())) { } elseif (is_tax() && ($template = get_taxonomy_template())) { } elseif (is_front_page() && ($template = get_front_page_template())) { } elseif (is_home() && ($template = get_home_template())) { } elseif (is_attachment() && ($template = get_attachment_template())) { } elseif (is_single() && ($template = get_single_template())) { } elseif (is_page() && ($template = get_page_template())) { } elseif (is_category() && ($template = get_category_template())) { } elseif (is_tag() && ($template = get_tag_template())) { } elseif (is_author() && ($template = get_author_template())) { } elseif (is_date() && ($template = get_date_template())) { } elseif (is_archive() && ($template = get_archive_template())) { } elseif (is_comments_popup() && ($template = get_comments_popup_template())) { } elseif (is_paged() && ($template = get_paged_template())) { } else { $template = get_index_template(); } return str_replace(ABSPATH, '', $template); } else { return null; } }
/** * @return bool * to be used in template files or with template redirect hook to check whether current page has a layout template */ function is_ddlayout_template() { global $wpddlayout; $temp = get_page_template(); $pos = strrpos($temp, '/'); $template = substr($temp, $pos + 1); return in_array($template, $wpddlayout->templates_have_layout(array($template => 'name'))); }
public function actAdminPrintScripts() { $currentScreen = $this->_getWPLayer()->get_current_screen(); $currentScreenId = $currentScreen->id; if (strpos($currentScreenId, 'ff-layout') !== false || strpos(get_page_template(), 'page-onepage') !== false || $currentScreenId == 'page') { $this->_unregisterEmoji(); } }
function wildcat_show404($template) { global $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query('pagename=error'); $wp_query->the_post(); $template404 = get_page_template(); rewind_posts(); return $template404; }
function my_page_template_redirect() { global $post; $arrayUrl = array('cacao-fino-de-aroma-en' => 'page-cacao-fino-de-aroma', 'cacao-fino-de-aroma-fr' => 'page-cacao-fino-de-aroma', 'cacao-fino-de-aroma-de' => 'page-cacao-fino-de-aroma', 'cacao-fino-de-aroma-sk' => 'page-cacao-fino-de-aroma', 'cacao-fino-de-aroma-it' => 'page-cacao-fino-de-aroma', 'cacao-fino-de-aroma-ru' => 'page-cacao-fino-de-aroma', 'product' => 'page-productos', 'produits' => 'page-productos', 'produkte' => 'page-productos', 'produkty' => 'page-productos', 'prodotto' => 'page-productos', 'products' => 'page-productos', 'tailor-made-innovation' => 'page-a-su-medida', 'linnovation-sur-mesure' => 'page-a-su-medida', 'kundenwunsch' => 'page-a-su-medida', 'vylepsenia-na-mieru' => 'page-a-su-medida', 'innovazione-su-misura' => 'page-a-su-medida', 'tailor-made-innovation-ru' => 'page-a-su-medida', 'the-luker-way-es' => 'page-the-luker-way', 'the-luker-way-fr' => 'page-the-luker-way', 'the-luker-way-de' => 'page-the-luker-way', 'the-luker-way-sk' => 'page-the-luker-way', 'the-luker-way-it' => 'page-the-luker-way', 'the-luker-way-ru' => 'page-the-luker-way', 'granja-luker-es' => 'page-granja-luker', 'granja-luker-fr' => 'page-granja-luker', 'granja-luker-de' => 'page-granja-luker', 'granja-luker-sk' => 'page-granja-luker', 'granja-luker-it' => 'page-granja-luker', 'granja-luker-ru' => 'page-granja-luker', 'contact' => 'page-contactenos', 'contactez-nous' => 'page-contactenos', 'kontakt' => 'page-contactenos', 'kontakty' => 'page-contactenos', 'contatti' => 'page-contactenos', 'contact-ru' => 'page-contactenos', 'news' => 'page-noticias', 'nouvelles' => 'page-noticias', 'aktuell' => 'page-noticias', 'novinky' => 'page-noticias', 'notizie' => 'page-noticias', 'news-ru' => 'page-noticias', 'recipes' => 'page-recetas', 'recettes' => 'page-recetas', 'rezepte' => 'page-recetas', 'recepty' => 'page-recetas', 'ricette' => 'page-recetas', 'recipes-ru' => 'page-recetas', 'thanks' => 'page-gracias', 'gracias' => 'page-gracias', 'ace' => 'page-gracias', 'dank' => 'page-gracias', 'hvala' => 'page-gracias', 'grazie' => 'page-gracias', 'thanks-ru' => 'page-gracias'); if (array_key_exists(get_post($post)->post_name, $arrayUrl)) { if (!get_page_template() && !is_home()) { get_template_part($arrayUrl[get_post($post)->post_name]); exit; } } }
/** * Page Builder Button */ public function page_builder_button() { global $post; // This button is only used for pages if (!in_array($post->post_type, array('page'))) { return; } // Check if we're using the builder for this page $is_builder_used = 'builder.php' == basename(get_page_template()) ? true : false; printf('<div id="layers_toggle_builder" class=" %3$s"> <div class="postbox layers-push-top"> <div class="layers-section-title layers-no-push-bottom layers-content-large"> <div class="layers-heading"> %1$s </div> <p class="layers-excerpt"> %5$s </p> </div> <div class="layers-button-well clearfix"> <a href="%2$s" class="layers-button btn-massive btn-primary btn-full" id="%4$s">%6$s</a> </div> </div> <div class="layers-row"> <div class="layers-column layers-span-4 postbox layers-content"> <div class="layers-section-title layers-tiny"> <h4 class="layers-heading">Export Layout</h4> <p class="layers-excerpt">Export your layout to a <code>.json</code> file which you can use to upload to another site.</p> </div> <a href="?post=%8$s&action=edit&layers-export=1" class="layers-button">Export</a> </div> <div class="layers-column layers-span-4 postbox layers-content"> <div class="layers-section-title layers-tiny"> <h4 class="layers-heading">Import Layout</h4> <p class="layers-excerpt"> Upload a layout file (eg. <code>%9$s.json</code>) by clicking the button below.</p> </div> <button class="layers-button" id="layers-page-import-button" data-post-id="%8$s" data-title="Upload .json" data-button_text="Upload & Import">Upload & Import</button> </div> <div class="layers-column layers-span-4 postbox layers-content"> <div class="layers-section-title layers-tiny"> <h4 class="layers-heading">Duplicate Layout</h4> <p class="layers-excerpt">Easily duplicate your layout, settings, text and images in order to get started quickly with a new page.</p> </div> <button href="" class="layers-button" id="layers-page-duplicate-button" data-post-id="%8$s">Duplicate</button> </div> </div> </div>', 'Your page is ready.', admin_url() . 'customize.php?url=' . esc_url(get_the_permalink()), true == $is_builder_used ? '' : 'layers-hide', isset($post->ID) ? 'builder-button-' . $post->ID : 'builder-button-' . rand(0, 1), __('You can drag and drop widgets, edit content and tweak the design. Click the button below to see your page come to life.', 'layerswp'), __('Edit Your Page', 'layerswp'), get_template_directory_uri(), get_the_ID(), $post->post_name); }
/** * Prepend {page_template} on the view stack for custom page * * @param array $options Current options. * * @return mixed */ public function set_template_as_first_option($options) { $page_template = get_page_template(); if ($page_template) { $page_template_base = basename($page_template); $page_template_pure = str_replace('.php', '', $page_template_base); // Reversed order; first look for 'custom', then 'single'. array_unshift($options, 'single/' . $page_template_pure); array_unshift($options, 'custom/' . $page_template_pure); } return $options; }
/** * Copy-pasta of wp-includes/template-loader.php */ private function load_template() { do_action('template_redirect'); $template = false; if (is_404() && ($template = get_404_template())) { } elseif (is_search() && ($template = get_search_template())) { } elseif (is_front_page() && ($template = get_front_page_template())) { } elseif (is_home() && ($template = get_home_template())) { } elseif (is_post_type_archive() && ($template = get_post_type_archive_template())) { } elseif (is_tax() && ($template = get_taxonomy_template())) { } elseif (is_attachment() && ($template = get_attachment_template())) { remove_filter('the_content', 'prepend_attachment'); } elseif (is_single() && ($template = get_single_template())) { } elseif (is_page() && ($template = get_page_template())) { } elseif (is_category() && ($template = get_category_template())) { } elseif (is_tag() && ($template = get_tag_template())) { } elseif (is_author() && ($template = get_author_template())) { } elseif (is_date() && ($template = get_date_template())) { } elseif (is_archive() && ($template = get_archive_template())) { } elseif (is_comments_popup() && ($template = get_comments_popup_template())) { } elseif (is_paged() && ($template = get_paged_template())) { } else { $template = get_index_template(); } /** * Filter the path of the current template before including it. * * @since 3.0.0 * * @param string $template The path of the template to include. */ if ($template = apply_filters('template_include', $template)) { $template_contents = file_get_contents($template); $included_header = $included_footer = false; if (false !== stripos($template_contents, 'get_header();')) { do_action('get_header', null); locate_template('header.php', true, false); $included_header = true; } include $template; if (false !== stripos($template_contents, 'get_footer();')) { do_action('get_footer', null); locate_template('footer.php', true, false); $included_footer = true; } if ($included_header && $included_footer) { global $wp_scripts; $wp_scripts->done = array(); } } return; }
/** * Exclude setting on section child page * @param object $field Current field object * @return bool * @author Jordan Pakrosnis */ function cmb_exclude_section_child_page($field) { // Get Current Template $current_template = basename(get_page_template()); // If it's a section page or section grid, check if it's a child // Exclude on these templates if ($current_template == 'page_section.php' || $current_template == 'page_section_grid.php') { $page_parents = get_post_ancestors($post); if ($page_parents[0] != '') { return 0; } } // if() return 1; }
/** * Add and remove body classes */ function nucleus_body_classes($classes) { // Add post/page slug if not present and template slug if (is_single() || is_page() && !is_front_page()) { if (!in_array(basename(get_permalink()), $classes)) { $classes[] = basename(get_permalink()); } $classes[] = str_replace('.php', '', basename(get_page_template())); } // Remove unnecessary classes $home_id_class = 'page-id-' . get_option('page_on_front'); $remove_classes = array('page-template-default', $home_id_class); $classes = array_diff($classes, $remove_classes); return $classes; }
function show404($template) { global $wp_query; $template404 = $template; $pageid = $this->settings['404page_page_id']; if ($pageid > 0) { $wp_query = null; $wp_query = new WP_Query(); $wp_query->query('page_id=' . $pageid); $wp_query->the_post(); $template404 = get_page_template(); rewind_posts(); } return $template404; }
/** * Exection hook * * @param Stencil_Interface $controller Controller that initiated this class. */ public function execute(Stencil_Interface $controller) { $post_type = get_post_type(); Stencil_Environment::trigger('single', $controller); Stencil_Environment::trigger($post_type, $controller); Stencil_Environment::trigger(get_the_ID(), $controller); $page_template = get_page_template(); if ($page_template) { // Always include template file. include $page_template; $page_template_base = basename($page_template); Stencil_File_System::load($page_template_base); Stencil_Environment::trigger(rtrim($page_template_base, '.php'), $controller); Stencil_Environment::trigger($page_template_base, $controller); } }
function use_plugin_on_current_page() { if ($this->use_on_current_page === null) { if (in_array(basename(get_page_template()), apply_filters('acfpbf_use_on_templates', array()))) { $use_on_current_page = true; } else { $panels_data = get_post_meta(get_the_ID(), 'panels_data', true); if (isset($panels_data) && !empty($panels_data)) { $use_on_current_page = false; } else { $use_on_current_page = true; } } $this->use_on_current_page = apply_filters('acfpbf_use_on_current_page', $use_on_current_page); } return $this->use_on_current_page; }
function supermag_front_page() { if ('posts' == get_option('show_on_front')) { include get_home_template(); } elseif (is_active_sidebar('supermag-home')) { ?> <div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <?php dynamic_sidebar('supermag-home'); ?> </main> <!-- #main --> </div><!-- #primary --> <?php } else { include get_page_template(); } }
/** * Before main content * * @since biography 1.0.0 * * @param null * @return null * */ function biography_front_page() { if ('posts' == get_option('show_on_front')) { include get_home_template(); } elseif (1 == biography_if_all_disable()) { /** * homepage hook * @since Biography 1.0.0 * * @hooked biography_home_service - 10 * @hooked biography_home_review - 20 * @subhooked biography_home_testimonial 10 * @hooked biography_home_history - 30 */ do_action('homepage'); } else { include get_page_template(); } }
function new_body_classes($classes) { if (is_page()) { $temp = get_page_template(); if ($temp != null) { $path = pathinfo($temp); $tmp = $path['filename'] . "." . $path['extension']; $tn = str_replace(".php", "", $tmp); $classes[] = $tn; } global $post; $classes[] = 'page-' . get_post($post)->post_name; if (is_active_sidebar('sidebar')) { $classes[] = 'with_sidebar'; } } if (is_page() && !is_front_page() || is_single()) { $classes[] = 'static-page'; } global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone; if ($is_lynx) { $classes[] = 'lynx'; } elseif ($is_gecko) { $classes[] = 'gecko'; } elseif ($is_opera) { $classes[] = 'opera'; } elseif ($is_NS4) { $classes[] = 'ns4'; } elseif ($is_safari) { $classes[] = 'safari'; } elseif ($is_chrome) { $classes[] = 'chrome'; } elseif ($is_IE) { $classes[] = 'ie'; } else { $classes[] = 'unknown'; } if ($is_iphone) { $classes[] = 'iphone'; } return $classes; }
function msdlab_bootstrap_sidebar_alt($attributes) { $layout = genesis_site_layout(); $template = get_page_template(); switch ($layout) { case 'content-sidebar': case 'sidebar-content': $attributes['class'] .= ' row col-md-4 col-12sm'; break; case 'content-sidebar-sidebar': case 'sidebar-sidebar-content': case 'sidebar-content-sidebar': $attributes['class'] .= ' row col-md-4 col-12sm'; break; case 'full-width-content': $attributes['class'] .= ' hidden'; break; } return $attributes; }
function maxie_styles() { wp_register_style('bootstrap', "http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css", false); wp_register_style('openSans', 'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600,700'); //css home wp_register_style('home-css', get_template_directory_uri() . '/css/home.css'); wp_register_style('general-css', get_template_directory_uri() . '/css/general.css'); /* global css */ wp_enqueue_style('bootstrap'); wp_enqueue_style('general-css'); switch (basename(get_page_template())) { case 'template_home.php': wp_enqueue_style('home-css'); break; } //special parts if (is_home()) { wp_enqueue_style('home-css'); } }
function steampunkd_scripts() { if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_enqueue_style('steampunkd_fonts', '//fonts.googleapis.com/css?family=Sorts+Mill+Goudy:400,400italic%7cAbril+Fatface'); wp_enqueue_script('steampunkd_modernizr', get_stylesheet_directory_uri() . '/js/modernizr.js', array('jquery'), '2.8.3', false); wp_enqueue_script('steampunkd_slicknavjs', get_stylesheet_directory_uri() . '/js/jquery.slicknav.js', array('jquery'), '1.0.4', false); wp_enqueue_style('steampunkd_slicknavcss', get_stylesheet_directory_uri() . '/css/slicknav/slicknav.css'); wp_enqueue_style('steampunkd-style', get_stylesheet_uri(), array(), '2015-08-07'); wp_enqueue_script('steampunkd_global', get_stylesheet_directory_uri() . '/js/global.js', array('jquery'), '1.0.0', true); if (!is_archive()) { $template = basename(get_page_template()); if ($template == 'template-front-page.php') { wp_enqueue_script('steampunkd_nivoslider', get_stylesheet_directory_uri() . '/js/jquery.nivo.slider.js', array('jquery'), '', false); wp_enqueue_style('steampunkd_nivoslider_css', get_stylesheet_directory_uri() . '/css/nivo/nivo-slider.css'); wp_enqueue_style('steampunkd_nivoslider_css_theme_default', get_stylesheet_directory_uri() . '/css/nivo/default.css'); wp_enqueue_script('steampunkd_theme', get_stylesheet_directory_uri() . '/js/theme.js', array('jquery'), '1.0.0', true); } } }
public function process() { // global $template; $template = get_page_template(); $template_path = QM_Util::standard_dir($template); $stylesheet_directory = QM_Util::standard_dir(get_stylesheet_directory()); $template_directory = QM_Util::standard_dir(get_template_directory()); $theme_directory = QM_Util::standard_dir(get_theme_root()); $template_file = str_replace(array($stylesheet_directory, $template_directory), '', $template_path); $template_file = ltrim($template_file, '/'); $theme_template = str_replace($theme_directory, '', $template_path); $theme_template = ltrim($theme_template, '/'); $this->data['template_path'] = $template_path; $this->data['template_file'] = $template_file; $this->data['theme_template'] = $theme_template; $this->data['stylesheet'] = get_stylesheet(); $this->data['template'] = get_template(); if (isset($this->data['body_class'])) { asort($this->data['body_class']); } }
function xtreme_get_template() { global $wp; if (defined('WP_USE_THEMES') && constant('WP_USE_THEMES')) { if (is_404() && ($template = get_404_template())) { return redefine_pagenow($template); } elseif (is_search() && ($template = get_search_template())) { return redefine_pagenow($template); } elseif (is_tax() && ($template = get_taxonomy_template())) { return redefine_pagenow($template); } elseif (is_front_page() && ($template = get_front_page_template())) { return redefine_pagenow($template); } elseif (is_home() && ($template = get_home_template())) { return redefine_pagenow($template); } elseif (is_attachment() && ($template = get_attachment_template())) { return redefine_pagenow($template); } elseif (is_single() && ($template = get_single_template())) { return redefine_pagenow($template); } elseif (is_page() && ($template = get_page_template())) { return redefine_pagenow($template); } elseif (is_category() && ($template = get_category_template())) { return redefine_pagenow($template); } elseif (is_tag() && ($template = get_tag_template())) { return redefine_pagenow($template); } elseif (is_author() && ($template = get_author_template())) { return redefine_pagenow($template); } elseif (is_date() && ($template = get_date_template())) { return redefine_pagenow($template); } elseif (is_archive() && ($template = get_archive_template())) { return redefine_pagenow($template); } elseif (is_comments_popup() && ($template = get_comments_popup_template())) { return redefine_pagenow($template); } elseif (is_paged() && ($template = get_paged_template())) { return redefine_pagenow($template); } else { $template = get_index_template(); return redefine_pagenow($template); } } }
/** * Initiates Section registration on appropriate pages * * @param string $id Section ID * @param string $title Section Title * @param array $args Section parameters: * 'templates' - list of templates where current section allowed; * 'priority' - priority of display section; */ public function __construct($id = '', $title = '', $args = array()) { $args = wp_parse_args($args, array('templates' => null, 'priority' => 10)); if (is_admin()) { add_action('load-profile.php', array($this, 'register')); add_action('load-user-edit.php', array($this, 'register')); // for front-end forms } elseif ($args['templates'] && is_page()) { $current_template = basename(get_page_template()); if (!is_array($args['templates'])) { $args['templates'] = array($args['templates']); } if (in_array($current_template, $args['templates'])) { $this->register(); } } else { return false; } $this->id = $id; $this->title = $title; $this->priority = $args['priority']; }
/** * Get the fork's parent post, set up a query, and load correct template. * * Duplicates the functionality of /wp-includes/template-loader.php and includes * a lot of copypasta, but that's only to ensure that it follows the same logic. * */ function choose_template() { $p = get_queried_object_id(); if (get_post_type($p) !== 'fork') { return; } $pp = get_post($p)->post_parent; $parent = get_post($pp); if ($parent->post_type == 'page') { $query = array('page_id' => $pp); } else { $query = array('p' => $pp); } $t = new WP_Query($query); $template = false; if ($t->is_404() && ($template = get_404_template())) { } elseif ($t->is_search() && ($template = get_search_template())) { } elseif ($t->is_tax() && ($template = get_taxonomy_template())) { } elseif ($t->is_front_page() && ($template = get_front_page_template())) { } elseif ($t->is_home() && ($template = get_home_template())) { } elseif ($t->is_attachment() && ($template = get_attachment_template())) { remove_filter('the_content', 'prepend_attachment'); } elseif ($t->is_single() && ($template = get_single_template())) { } elseif ($t->is_page && ($template = get_page_template())) { } elseif ($t->is_category() && ($template = get_category_template())) { } elseif ($t->is_tag() && ($template = get_tag_template())) { } elseif ($t->is_author() && ($template = get_author_template())) { } elseif ($t->is_date() && ($template = get_date_template())) { } elseif ($t->is_archive() && ($template = get_archive_template())) { } elseif ($t->is_comments_popup() && ($template = get_comments_popup_template())) { } elseif ($t->is_paged() && ($template = get_paged_template())) { } else { $template = get_index_template(); } if ($template = apply_filters('template_include', $template)) { include $template; } return; }
function dwwp_load_templates($original_template) { if (get_query_var('post_type') !== 'job') { return; } if (is_archive() || is_search()) { if (file_exists(get_stylesheet_directory() . '/archive-job.php')) { return get_stylesheet_directory() . '/archive-job.php'; } else { return plugin_dir_path(__FILE__) . 'templates/archive-job.php'; } } elseif (is_singular('job')) { if (file_exists(get_stylesheet_directory() . '/single-job.php')) { return get_stylesheet_directory() . '/single-job.php'; } else { return plugin_dir_path(__FILE__) . 'templates/single-job.php'; } } else { return get_page_template(); } return $original_template; }
public static function page($page_id) { static $current = null; // Blog page is still a page if ($page_id == get_option('page_for_posts')) { return self::blog($page_id); } wb_set('current_url', get_permalink($page_id)); query_posts(array('page_id' => $page_id)); the_post(); // Avoid infinite loop $template = get_page_template(); if ($template === $current) { $template = self::get_home_template(); } rewind_posts(); wb_link_hack(true); $current = $template; include $template; $current = null; wb_link_hack(false); wp_reset_query(); }