• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_page_template_slug函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_page_template_slug函数的典型用法代码示例。如果您正苦于以下问题:PHP get_page_template_slug函数的具体用法?PHP get_page_template_slug怎么用?PHP get_page_template_slug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_page_template_slug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: render_content

 public function render_content()
 {
     $llorix_one_all_pages_array = array();
     // new array with all pages
     $llorix_one_all_pages = get_pages();
     // get all pages
     if (!empty($llorix_one_all_pages)) {
         $llorix_one_all_pages_array[0] = "-- Select --";
         foreach ($llorix_one_all_pages as $llorix_one_page) {
             if (!empty($llorix_one_page->ID) && !empty($llorix_one_page->post_title)) {
                 $llorix_one_all_pages_array[$llorix_one_page->ID] = $llorix_one_page->post_title;
             }
         }
     }
     if (!empty($llorix_one_all_pages_array)) {
         // change the frontpage control with the new array
         echo '<label>';
         echo '<span class="customize-control-title">' . esc_html($this->label) . '</span>';
         echo '<select data-customize-setting-link="page_on_front" name="_customize-dropdown-pages-page_on_front" id="_customize-dropdown-pages-page_on_front">';
         foreach ($llorix_one_all_pages_array as $llorix_one_all_pages_array_k => $llorix_one_all_pages_array_v) {
             $llorix_one_page_template = get_page_template_slug($llorix_one_all_pages_array_k);
             if (!empty($llorix_one_page_template)) {
                 echo '<option value="' . $llorix_one_all_pages_array_k . '" template="' . $llorix_one_page_template . '">' . $llorix_one_all_pages_array_v . '</option>';
             } else {
                 echo '<option value="' . $llorix_one_all_pages_array_k . '" template="default">' . $llorix_one_all_pages_array_v . '</option>';
             }
         }
         echo '</select>';
         echo '</label>';
     }
 }
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:31,代码来源:llorix-one-lite-text-control.php


示例2: display

    public function display($post)
    {
        if (!empty($this->settings['page_template'])) {
            //echo $this->settings['page_template'];
            $page_template = get_page_template_slug(get_queried_object_id());
            if ($page_template != $this->settings['page_template']) {
                return false;
            }
        }
        $this->postID = $post->ID;
        wp_nonce_field($this->settings['id'], TF . '_' . $this->settings['id'] . '_nonce');
        if (!empty($this->settings['desc'])) {
            ?>
<p class='description'><?php 
            echo $this->settings['desc'];
            ?>
</p><?php 
        }
        ?>
		<table class="form-table tf-form-table">
		<tbody>
		<?php 
        foreach ($this->options as $option) {
            $option->display();
        }
        ?>
		</tbody>
		</table>
		<?php 
    }
开发者ID:gambitph,项目名称:titan-framework,代码行数:30,代码来源:class-meta-box.php


示例3: mp_stacks_remove_hentry_from_stack_page_templates

/**
 * Remove "hentry" from page post_class if the page template is "Optimize for MP Stacks"
 *
 * @since 1.0
 * @return void
*/
function mp_stacks_remove_hentry_from_stack_page_templates($classes)
{
    global $post;
    $class_name_counter = 0;
    //Loop through each class name
    foreach ($classes as $class_name) {
        $page_template_slug = get_page_template_slug($post->ID);
        //If one of the class names is hentry
        if ($class_name == 'hentry') {
            //If we are using the mp-stacks-page-template
            if (get_page_template_slug($post->ID) == 'mp-stacks-page-template.php') {
                //Remove hentry from the classes array
                $classes[$class_name_counter] = '';
            } else {
                if (empty($page_template_slug)) {
                    //Check the title of the default page template - This filter: https://core.trac.wordpress.org/ticket/27178
                    $default_page_template_title = apply_filters('default_page_template_title', __('Default Template'));
                    //If the default page template's title includes the word "Stack"
                    if (strpos($default_page_template_title, 'Stack') !== false) {
                        //Remove hentry from the classes array
                        $classes[$class_name_counter] = '';
                    }
                }
            }
        }
        $class_name_counter = $class_name_counter + 1;
    }
    return $classes;
}
开发者ID:arrezende,项目名称:promillus,代码行数:35,代码来源:misc-functions.php


示例4: menu_endpoint

function menu_endpoint($data)
{
    $args = array('order' => 'ASC', 'orderby' => 'menu_order', 'post_type' => 'nav_menu_item', 'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order', 'nopaging' => true, 'update_post_term_cache' => false);
    $menu = wp_get_nav_menu_items($data['id'], $args);
    $fallback_menu = wp_get_nav_menu_items('2', $args);
    $menu = json_decode(json_encode($menu), true);
    $fallback_menu = json_decode(json_encode($fallback_menu), true);
    if ($menu != false) {
        $menu = $menu;
    } else {
        $menu = $fallback_menu;
    }
    for ($i = 0; $i < sizeof($menu); $i++) {
        unset($menu[$i]['post_password']);
        unset($menu[$i]['post_name']);
        unset($menu[$i]['to_ping']);
        unset($menu[$i]['pinged']);
        unset($menu[$i]['post_modified']);
        unset($menu[$i]['post_modified_gmt']);
        unset($menu[$i]['post_content_filtered']);
        unset($menu[$i]['post_parent']);
        unset($menu[$i]['post_mime_type']);
        unset($menu[$i]['comment_count']);
        unset($menu[$i]['filter']);
        unset($menu[$i]['object']);
        unset($menu[$i]['type']);
        unset($menu[$i]['post_date']);
        unset($menu[$i]['post_date_gmt']);
        $menu[$i]['template'] = split('.php', get_page_template_slug($menu[$i]['object_id']))[0];
    }
    //if the id would return nothing - return the default menu
    return $menu;
}
开发者ID:stagfoo,项目名称:Headless-Bankend,代码行数:33,代码来源:menu.php


示例5: kt_metabox_show_on_kt_template

function kt_metabox_show_on_kt_template($display, $meta_box)
{
    if ('kt-template' !== $meta_box['show_on']['key']) {
        return $display;
    }
    // Get the current ID
    if (isset($_GET['post'])) {
        $post_id = $_GET['post'];
    } elseif (isset($_POST['post_ID'])) {
        $post_id = $_POST['post_ID'];
    }
    if (!isset($post_id)) {
        return false;
    }
    $template_name = get_page_template_slug($post_id);
    $template_name = substr($template_name, 0, -4);
    // If value isn't an array, turn it into one
    $meta_box['show_on']['value'] = !is_array($meta_box['show_on']['value']) ? array($meta_box['show_on']['value']) : $meta_box['show_on']['value'];
    // See if there's a match
    if (in_array($template_name, $meta_box['show_on']['value'])) {
        return false;
    } else {
        return true;
    }
}
开发者ID:pcuervo,项目名称:od4d,代码行数:25,代码来源:metaboxes.php


示例6: get_hidden_layouts

 public function get_hidden_layouts($field)
 {
     global $wpdb, $post;
     if (!isset($field["parent_layout"])) {
         return;
     }
     if (is_object($post) && isset($post->ID)) {
         $post_id = $post->ID;
     } else {
         return;
     }
     $template = get_page_template_slug($post_id);
     $content = $wpdb->get_var($wpdb->prepare("SELECT post_content FROM {$wpdb->posts} WHERE post_name = %s", $field["parent"]));
     $content = unserialize($content);
     $hides = array();
     if (is_array($content) && isset($content["layouts"])) {
         foreach ($content["layouts"] as $layout) {
             if (!isset($layout["visibility"])) {
                 continue;
             }
             $visibility = array_filter(explode(" ", str_replace(",", " ", $layout["visibility"])));
             if (in_array($template, $visibility)) {
                 $hides[$layout["name"]] = $layout["visibility"];
             }
         }
     }
     foreach ($hides as $key => $hide) {
         $this->css[] = "div.acf-fc-popup a[data-layout='" . $key . "'] { display: none; }\n";
     }
 }
开发者ID:devgeniem,项目名称:acf-flexible-visibility,代码行数:30,代码来源:plugin.php


示例7: conditional_scripts

 public function conditional_scripts()
 {
     global $PhoenixData, $template;
     $what_template = get_page_template_slug();
     if ($what_template == 'template-portfolio.php' || basename($template) == 'single-' . THEME_SLUG . '_portfolio.php') {
         $cubeportfolio = array('inlineError' => __("Error! Please refresh the page!", 'grandway'), 'moreLoading' => __("Loading...", 'grandway'), 'moreNoMore' => __("No More Works", 'grandway'));
         $port_layout = isset($PhoenixData['port_layout']) ? $PhoenixData['port_layout'] : '2-cols';
         switch ($port_layout) {
             case '2-cols':
                 $cube_js = 'portfolio-2';
                 break;
             case '3-cols':
                 $cube_js = 'portfolio-3';
                 break;
             case '4-cols':
                 $cube_js = 'portfolio-4';
                 break;
             case 'full':
                 $cube_js = 'portfolio-fullwidth';
                 break;
             default:
                 $cube_js = 'portfolio-2';
                 break;
         }
         wp_register_script(THEME_SLUG . '-portfolio', THEME_URI . '/assets/js/' . $cube_js . '.js', array('jquery'), '1.0.0', true);
         wp_enqueue_script(THEME_SLUG . '-portfolio');
         wp_localize_script(THEME_SLUG . '-jquery.cubeportfolio', 'portSetts', $cubeportfolio);
     }
     if (is_singular(THEME_SLUG . '_portfolio')) {
         wp_dequeue_script(THEME_SLUG . '-portfolio');
         wp_enqueue_script(THEME_SLUG . '-portfolio-single', THEME_URI . '/assets/js/portfolio-3.js', array('jquery'), '1.0.0', true);
     }
 }
开发者ID:WillLin,项目名称:CS-SC-Front-End,代码行数:33,代码来源:scripts.php


示例8: wptgbs_link_to_id_filter

 function wptgbs_link_to_id_filter($atts, $item, $args)
 {
     if (get_page_template_slug() == 'home.php') {
         // $atts['href']   		= '#'.get_post_type($item->object_id).'-'.$item->object_id;
         $atts['href'] = '#post-' . $item->object_id;
     }
     return $atts;
 }
开发者ID:thomasgeissl,项目名称:wptgbs,代码行数:8,代码来源:navigation.php


示例9: get_current_template

/**
 * Get current template
 * 
 * @return string
 */
function get_current_template()
{
    // Get page id for all pages and detail pages
    global $post;
    // $page_id = (isset($post->detail_id)) ? $post->detail_id: get_queried_object_id();
    $page_id = isset($post->ID) ? $post->ID : get_queried_object_id();
    return basename(get_page_template_slug($page_id), '.php');
}
开发者ID:troubletribbles,项目名称:dr_bootstrap,代码行数:13,代码来源:utility.php


示例10: quest_is_pb_template

 /**
  * Is the current page a Page Builder Page ?
  *
  * @since  1.3.0
  * @return string html menu
  */
 function quest_is_pb_template()
 {
     global $post;
     if ($post && !is_search() && get_page_template_slug($post->ID) === 'page-builder.php') {
         return true;
     }
     return false;
 }
开发者ID:chirox,项目名称:quest,代码行数:14,代码来源:metaboxes.php


示例11: rs_theme_show_if_full_width

function rs_theme_show_if_full_width($cmb)
{
    // Show this metabox if it's full width
    if ('page-templates/template-fullwidth.php' == get_page_template_slug($cmb->object_id)) {
        return true;
    }
    return false;
}
开发者ID:ryscript,项目名称:Scinttek-Decade-Project,代码行数:8,代码来源:init.php


示例12: addMetaBox

 public function addMetaBox()
 {
     $templates = get_page_templates();
     $template = get_page_template_slug();
     if ($this->pageTemplate == 'any' || $templates[$this->pageTemplate] == $template) {
         add_meta_box($this->id, $this->title, [$this->metaTemplate, 'getHtml'], $this->type, $this->context, $this->priority);
     }
 }
开发者ID:superhero,项目名称:wp-facade-foundation,代码行数:8,代码来源:MetaBox.php


示例13: teaberry_add_mce_body_tags

/**
 * add body tags to mce editor based on current template
 */
function teaberry_add_mce_body_tags($classes)
{
    global $post;
    $template = get_page_template_slug($post->ID);
    if ($template == 'page-templates/full-width.php') {
        $classes['body_class'] = 'full-width';
    }
    return $classes;
}
开发者ID:honeymustard,项目名称:teaberry,代码行数:12,代码来源:mce.php


示例14: setCurrentPostInformation

 private function setCurrentPostInformation()
 {
     //Parse our WordPress template formatting to get another potential match for content.
     $this->currentPostInfo = array('id' => get_the_ID(), 'title' => get_the_title(), 'slug' => basename(get_permalink()), 'templateType' => '');
     if (is_page_template()) {
         $rawSlug = preg_match('/(?<=\\/).*?(?=-)/', get_page_template_slug(), $matchedSlug);
         $this->currentPostInfo['templateType'] = $matchedSlug[0] . "-section-sidebar";
     }
 }
开发者ID:UWAA,项目名称:uwaa-2014,代码行数:9,代码来源:SidebarFeaturedPost.php


示例15: filter_by_template_page

 /**
  * Filter that allow to change the sizes on pages that uses custom
  * page templates.
  *
  * @since 1.1.0
  *
  * @param array $sizes The images sizes.
  * @param int   $id The id of the post, page or custom post type.
  * @return return the array with the new sizes.
  */
 public function filter_by_template_page($sizes, $id = 0)
 {
     $template = get_page_template_slug($id);
     if (empty($template)) {
         return $sizes;
     }
     $template_name = Formatter::to_filter_format($template);
     return apply_filters(Formatter::katana_filter($template_name), $sizes);
 }
开发者ID:mitogh,项目名称:katana,代码行数:19,代码来源:Page.php


示例16: tcs_responsive_scripts

/**
 * @file
 * Copyright (C) 2014 TopCoder Inc., All Rights Reserved.
 * @author TCSASSEMBLER, ecnu_haozi
 * @version 1.1
 *
 * Enqueue scripts and stylesheets
 *
 * CDN will also be used for jquery.  We will have a local fallback
 * The theme option jsCssUseCDN will be used to say if local files will be on the cdn.
 *  Grunt script is what pushes the script.
 * Theme option jsCssUseMin will be used to only enqueue the min version.
 *  Grunt will create a style.css and script.js file that will contain all of the local code
 *
 * Changed in 1.1
 *  Add angular-animation.js.
 */
function tcs_responsive_scripts()
{
    // register scripts that are used everywhere
    $assets = array('jquery' => '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', 'jquery_ui' => '//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js', 'respond' => '/js/vendor/respond.min.js', 'modernizr' => '/js/vendor/modernizr.js', 'html5shiv' => '/js/vendor/html5shiv.js', 'auth0' => '//cdn.auth0.com/w2/auth0-1.6.4.js');
    tsc_register_master($assets);
    $jsCssUseMin = TC_USE_MIN;
    $template_map = tsc_get_asset_map();
    $queried_object_id = get_queried_object_id();
    if ($queried_object_id !== 0) {
        $page_template = get_page_template_slug($queried_object_id);
    }
    $ver = TC_CDN_VER == 1 ? TC_CDN_VER : '1';
    $jsCssUseCDN = TC_USE_CDN;
    if (isset($page_template) && isset($template_map[$page_template])) {
        $asset_map = $template_map[$page_template];
    } else {
        $asset_map = $template_map['default'];
    }
    if ($jsCssUseMin && $jsCssUseCDN) {
        // version number is in url when using cdn
        wp_register_script($asset_map['name'], tsc_build_asset_path($asset_map['name'], 'js', true, true), array('jquery', 'jquery_ui', 'auth0'), null, true);
        wp_register_style($asset_map['name'], tsc_build_asset_path($asset_map['name'], 'css', true, true));
        wp_enqueue_script($asset_map['name']);
        wp_enqueue_style($asset_map['name']);
    } elseif ($jsCssUseMin) {
        // version number is in url when using cdn
        wp_register_script($asset_map['name'], tsc_build_asset_path($asset_map['name'], 'js', true), array('jquery', 'jquery_ui', 'auth0'), $ver, true);
        wp_register_style($asset_map['name'], tsc_build_asset_path($asset_map['name'], 'css', true), array(), $ver);
        wp_enqueue_script($asset_map['name']);
        wp_enqueue_style($asset_map['name']);
    } else {
        $i = 0;
        foreach ($asset_map['js'] as $js_script) {
            if ($i == 0) {
                wp_register_script("custom-{$i}", tsc_build_asset_path($js_script, 'js'), array("jquery", "auth0"), $ver, true);
            } else {
                $j = $i - 1;
                wp_register_script("custom-{$i}", tsc_build_asset_path($js_script, 'js'), array("custom-{$j}"), $ver, true);
            }
            wp_enqueue_script("custom-{$i}");
            $i++;
        }
        $i = 0;
        foreach ($asset_map['css'] as $css_script) {
            if ($i == 0) {
                wp_enqueue_style("custom-{$i}", tsc_build_asset_path($css_script, 'css'), array(), $ver);
            } else {
                $j = $i - 1;
                wp_enqueue_style("custom-{$i}", tsc_build_asset_path($css_script, 'css'), array("custom-{$j}"), $ver);
            }
            $i++;
        }
    }
}
开发者ID:thabofletcher,项目名称:tc-site,代码行数:71,代码来源:scripts.php


示例17: getPageTemplate

 /**
  * Gets the template file from the id. If the template is not in use by the
  * current theme then 'default' is returned. This does not handle page
  * specific php files.
  *
  * @param int id The id of the page template to return. If no id is specified
  *     then the id of the current page is used.
  *
  * @return string The template name if it is in use, default otherwise
  */
 private static function getPageTemplate($id = null)
 {
     $template = get_page_template_slug($id);
     if (is_string($template) && $template != '') {
         $templates = wp_get_theme()->get_page_templates();
         if (array_key_exists($template, $templates)) {
             return $template;
         }
     }
     return 'default';
 }
开发者ID:mttcmrn,项目名称:Suffield-Bruins-WP,代码行数:21,代码来源:Utils.php


示例18: oxford_is_single_column

 /**
  * Determine if a post should display in a single column or not.
  *
  * @since 1.1.3.
  *
  * @param  int     $post_id    The post ID.
  * @return bool                True if post should display in single column.
  */
 function oxford_is_single_column($post_id)
 {
     $post_id = absint($post_id);
     $is = false;
     $char_count = oxford_get_post_char_count($post_id);
     $threshold = oxford_get_post_char_threshold();
     if (0 !== $post_id && ($char_count < $threshold && (is_single() || is_page() && 'two-column-page.php' === get_page_template_slug()) || is_single() && true === oxford_get_post_meta('settings', $post_id, 'post-single-column'))) {
         $is = true;
     }
     return apply_filters('oxford_is_single_column', $is, $post_id);
 }
开发者ID:andrewkhunn,项目名称:lancero,代码行数:19,代码来源:extras.php


示例19: trunck_modular_css

function trunck_modular_css()
{
    // Enqueue the main Stylesheet.
    if (ENVIRONMENT == "development") {
        wp_enqueue_style('trunck-main-stylesheet', get_stylesheet_directory_uri() . '/css/global.css', array(), $version, "screen");
        error_log("page slug: " . get_page_template_slug());
    } else {
        wp_enqueue_style('trunck-main-stylesheet', get_stylesheet_directory_uri() . '/css/global.min.css', array(), $version, "screen");
    }
    wp_enqueue_style('trunck-print-stylesheet', get_stylesheet_directory_uri() . '/css/print.min.css', array(), $version, "print");
    wp_enqueue_style('trunck-theme-stylesheet', get_stylesheet_directory_uri() . '/style.css', array(), $version, "screen");
}
开发者ID:gholme4,项目名称:trunck_theme,代码行数:12,代码来源:enqueue.php


示例20: get

 /**
  * Returns the type for the post, the term template applies to what type of
  * post is or what type of template is using.
  *
  * @param Int|\WP_Post $post The post
  * @return string
  */
 public static function get($post)
 {
     $post = is_a($post, 'WP_Post') ? $post : get_post($post);
     $type = $post->post_type;
     if ('page' === $type) {
         $template_slug = get_page_template_slug($post->ID);
         if (!empty($template_slug)) {
             $type .= '-' . wp_basename($template_slug, '.php');
         }
     }
     return $type;
 }
开发者ID:moxie-leean,项目名称:wp-endpoints-post,代码行数:19,代码来源:Type.php



注:本文中的get_page_template_slug函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_page_templates函数代码示例发布时间:2022-05-15
下一篇:
PHP get_page_template函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap