本文整理汇总了PHP中get_page_template函数的典型用法代码示例。如果您正苦于以下问题:PHP get_page_template函数的具体用法?PHP get_page_template怎么用?PHP get_page_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_page_template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zgm_flexible_content
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
}
示例2: gllr_template_redirect
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;
}
}
示例3: incir_body_class
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;
}
示例4: evision_corporate_front_page
/**
* 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');
}
}
示例5: __construct
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();
}
}
示例6: getWpTemplate
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;
}
}
示例7: is_ddlayout_template
/**
* @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')));
}
示例8: actAdminPrintScripts
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();
}
}
示例9: wildcat_show404
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;
}
示例10: my_page_template_redirect
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;
}
}
}
示例11: page_builder_button
/**
* 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);
}
示例12: set_template_as_first_option
/**
* 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;
}
示例13: load_template
/**
* 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;
}
示例14: cmb_exclude_section_child_page
/**
* 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;
}
示例15: nucleus_body_classes
/**
* 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;
}