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

PHP get_page_templates函数代码示例

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

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



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

示例1: render

 function render()
 {
     $updated = isset($_GET['incsub_event_settings_saved']) && $_GET['incsub_event_settings_saved'] == 1;
     if (!class_exists('WpmuDev_HelpTooltips')) {
         require_once eab_plugin_dir() . 'lib/class_wd_help_tooltips.php';
     }
     $tips = new WpmuDev_HelpTooltips();
     $tips->set_icon_url(eab_plugin_url() . 'img/information.png');
     if (!(defined('EAB_PREVENT_SETTINGS_SECTIONS') && EAB_PREVENT_SETTINGS_SECTIONS)) {
         $tabbable = 'tabbable';
     } else {
         $tabbable = false;
     }
     $hide = !empty($tabbable) ? 'hide' : '';
     $archive_tpl = file_exists(get_stylesheet_directory() . '/archive-incsub_event.php') ? get_stylesheet_directory() . '/archive-incsub_event.php' : get_template_directory() . '/archive-incsub_event.php';
     $archive_tpl_present = apply_filters('eab-settings-appearance-archive_template_copied', file_exists($archive_tpl));
     $single_tpl = file_exists(get_stylesheet_directory() . '/single-incsub_event.php') ? get_stylesheet_directory() . '/single-incsub_event.php' : get_template_directory() . '/single-incsub_event.php';
     $single_tpl_present = apply_filters('eab-settings-appearance-single_template_copied', file_exists($single_tpl));
     $theme_tpls_present = apply_filters('eab-settings-appearance-templates_copied', $archive_tpl_present && $single_tpl_present);
     $raw_tpl_sets = glob(EAB_PLUGIN_DIR . 'default-templates/*');
     $templates = array();
     foreach ($raw_tpl_sets as $item) {
         if (!is_dir($item)) {
             continue;
         }
         $key = basename($item);
         $label = ucwords(preg_replace('/[^a-z0-9]+/i', ' ', $key));
         $templates[$key] = sprintf(__("Plugin: %s", eab_domain()), $label);
     }
     foreach (get_page_templates() as $name => $tpl) {
         $templates[$tpl] = sprintf(__("Theme: %s", eab_domain()), $name);
     }
     include_once 'views/settings-menu.php';
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:34,代码来源:class-eab-settings-menu.php


示例2: wpcf_admin_get_templates_by_group

/**
 * Gets templates supported by specific group.
 *
 * @param type $group_id
 * @return type
 */
function wpcf_admin_get_templates_by_group($group_id)
{
    /**
     * sanitized $group_id
     */
    $group_id = intval($group_id);
    if (empty($group_id)) {
        return array();
    }
    $data = get_post_meta($group_id, '_wp_types_group_templates', true);
    if ($data == 'all') {
        return array();
    }
    $data = explode(',', trim($data, ','));
    $templates = get_page_templates();
    $templates[] = 'default';
    $templates_views = get_posts('post_type=view-template&numberposts=-1&status=publish');
    foreach ($templates_views as $template_view) {
        $templates[] = $template_view->ID;
    }
    $result = array();
    if (!empty($data)) {
        foreach ($templates as $template) {
            if (in_array($template, $data)) {
                $result[] = $template;
            }
        }
    }
    return $result;
}
开发者ID:otkinsey,项目名称:wp-nsds,代码行数:36,代码来源:fields.php


示例3: body

    function body()
    {
        global $post;
        if (0 != count(get_page_templates())) {
            //$template = !empty($post->page_template) ? $post->page_template : false;
            $template = get_post_meta($post->ID, '_wp_page_template', true);
            $template = '' == trim($template) ? false : $template;
            ?>
<p><strong><?php 
            _e('Template', 'rhc');
            ?>
</strong></p>
<label class="screen-reader-text" for="page_template"><?php 
            _e('Page Template', 'rhc');
            ?>
</label><select name="_wp_page_template" id="_wp_page_template">
<option value='default'><?php 
            _e('Default Template', 'rhc');
            ?>
</option>
<?php 
            page_template_dropdown($template);
            ?>
</select>
<?php 
        }
    }
开发者ID:kaydwithers,项目名称:crossfittanjongpagar,代码行数:27,代码来源:class.rhc_event_template_metabox.php


示例4: get_visibility_value

 public function get_visibility_value()
 {
     $return = (object) ["templates" => get_page_templates()];
     if (isset($_REQUEST["layout_id"]) && ctype_xdigit($_REQUEST["layout_id"]) && isset($_REQUEST["id"]) && is_numeric($_REQUEST["id"])) {
         $field_id = $_REQUEST["layout_id"];
         $post_id = $_REQUEST["id"];
     } else {
         wp_send_json_success($return);
     }
     $post = get_post($post_id);
     $post_obj = unserialize($post->post_content);
     $found = false;
     foreach ($post_obj["layouts"] as $obj) {
         if ($obj["key"] == $field_id) {
             $found = true;
             break;
         }
     }
     if (!$found) {
         wp_send_json_success($return);
     }
     if (is_array($obj) && isset($obj["visibility"])) {
         if (!empty($obj["visibility"])) {
             $return->visibility = explode(",", $obj["visibility"]);
             wp_send_json_success($return);
         } else {
             wp_send_json_success($return);
         }
     } else {
         wp_send_json_success($return);
     }
 }
开发者ID:devgeniem,项目名称:acf-flexible-visibility,代码行数:32,代码来源:plugin.php


示例5: get_page_templates

 function get_page_templates()
 {
     $templates = get_page_templates();
     ksort($templates);
     $page_templates = array();
     if (is_array($templates)) {
         foreach ($templates as $template) {
             $template_data = implode('', file(TEMPLATEPATH . "/" . $template));
             preg_match('|emplate Name:(.*)$|mi', $template_data, $name);
             // Using emplate instead of Template intentionally
             preg_match('|Description:(.*)$|mi', $template_data, $description);
             preg_match('|Exclude:(.*)$|mi', $template_data, $exclude);
             $name = $name[1];
             $description = $description[1];
             $exclude = trim($exclude[1]);
             if (!empty($name)) {
                 if (!empty($exclude)) {
                     continue;
                 }
                 $page_templates[trim($name)] = basename($template);
             }
         }
     }
     return $page_templates;
 }
开发者ID:Alenjandro,项目名称:data-my-share,代码行数:25,代码来源:remix_advanced_editor.php


示例6: fti_page_templates_summary

function fti_page_templates_summary()
{
    echo '<h1>' . _x('Page Template Usage', 'Admin Menu Name', 'pagetemplateusageinfo') . '</h1>';
    // Get the List of Templates from the theme
    $templates = get_page_templates();
    // Get the list of templates references in the database
    $templateUse = fti_page_templates_get_templateUsage();
    // Sort array by key
    ksort($templates);
    // Print theme count info
    echo sprintf('<p>' . _x('There are <strong>%d</strong> templates included in the <strong>%s</strong> theme.', 'Template Statistics', 'pagetemplateusageinfo') . '</p>', count($templates), wp_get_theme());
    echo '<table id="fti_page_templates_templateList"><thead><tr><th>' . _x('Tempalte Name', 'Table Column Heading', 'pagetemplateusageinfo') . '</th><th>' . _x('Tempalte Filename', 'Table Column Heading', 'pagetemplateusageinfo') . '</th><th>' . _x('# of Pages Using Template', 'Table Column Heading', 'pagetemplateusageinfo') . '</th></tr></thead><tbody>';
    // Start with Default Template
    echo '<tr>';
    echo sprintf('<td>%s</td><td>%s</td><td><a href="edit.php?post_type=page&page=fti_page_templates&template=%s">%d</a></td>', 'page.php', 'default', 'page.php', $templateUse['default']->pages_using);
    echo '</tr>';
    // Loop through the themes
    foreach ($templates as $template_name => $template_filename) {
        echo '<tr>';
        echo sprintf('<td>%s</td><td>%s</td><td><a href="edit.php?post_type=page&page=fti_page_templates&template=%s">%d</a></td>', $template_name, $template_filename, $template_filename, $templateUse[$template_filename]->pages_using);
        echo '</tr>';
    }
    echo '</tbody></table>';
    // Sort the Table by Page Usage
    echo '<script>jQuery(document).ready(function() { jQuery("#fti_page_templates_templateList").tablesorter({sortList: [[2,0]]}) })</script>';
}
开发者ID:shawnhooper,项目名称:page-template-usage-info,代码行数:26,代码来源:fti_page_templates.php


示例7: 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


示例8: _get_content

 /**
  * Get page templates
  * @param  array $args
  * @return array 
  */
 protected function _get_content($args = array())
 {
     $templates = array_flip(get_page_templates());
     if (isset($args['include'])) {
         $templates = array_intersect_key($templates, array_flip($args['include']));
     }
     return $templates;
 }
开发者ID:adamjcsmith,项目名称:new-csp,代码行数:13,代码来源:page_template.php


示例9: tf_get_templates

function tf_get_templates()
{
    $tmp = get_page_templates();
    $templates = array('none' => __('Select template', 'tfuse'));
    foreach ($tmp as $key => $val) {
        $templates[$val] = $key;
    }
    return $templates;
}
开发者ID:shimion,项目名称:stlucks,代码行数:9,代码来源:SIDEBARS.php


示例10: admin_body_class

 /**
  * Add custom body class when it's a page type.
  *
  * @param  string $classes
  *
  * @return string
  */
 public function admin_body_class($classes)
 {
     if (!in_array($this->post_type, papi_get_post_types())) {
         return $classes;
     }
     if (count(get_page_templates())) {
         $classes .= 'papi-hide-cpt';
     }
     return $classes;
 }
开发者ID:ekandreas,项目名称:papi,代码行数:17,代码来源:class-papi-admin.php


示例11: test_page_templates

 /**
  * @ticket 10959
  * @ticket 11216
  */
 function test_page_templates()
 {
     $theme = get_theme('Page Template Theme');
     $this->assertFalse(empty($theme));
     switch_theme($theme['Template'], $theme['Stylesheet']);
     $templates = get_page_templates();
     $this->assertEquals(3, count($templates));
     $this->assertEquals("template-top-level.php", $templates['Top Level']);
     $this->assertEquals("subdir/template-sub-dir.php", $templates['Sub Dir']);
     $this->assertEquals("template-header.php", $templates['This Template Header Is On One Line']);
 }
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:15,代码来源:includesTheme.php


示例12: getPageTemplateNames

 public static function getPageTemplateNames()
 {
     $templates = get_page_templates();
     $templates_names = array();
     foreach ($templates as $key => $value) {
         if ($value !== 'landing.php') {
             $templates_names[$key] = $key;
         }
     }
     return $templates_names;
 }
开发者ID:gabzon,项目名称:experiensa,代码行数:11,代码来源:Helpers.php


示例13: _get_content

 /**
  * Get page templates
  *
  * @since  1.0
  * @param  array $args
  * @return array 
  */
 protected function _get_content($args = array())
 {
     $templates = array_flip(get_page_templates());
     if (isset($args['include'])) {
         $templates = array_intersect_key($templates, array_flip($args['include']));
     }
     if (isset($args["search"]) && $args["search"]) {
         $this->search_string = $args["search"];
         $templates = array_filter($templates, array($this, "_filter_search"));
     }
     return $templates;
 }
开发者ID:thibaultvanc,项目名称:plombier,代码行数:19,代码来源:page_template.php


示例14: admin

 public static function admin()
 {
     parent::admin();
     $tpl = get_page_templates();
     if (count($tpl) > 0) {
         $list = array();
         foreach ($tpl as $tplname => $tplfile) {
             $list[basename($tplfile)] = $tplname;
         }
         self::mkGUI(self::$type, self::$option[self::$name], self::$question, self::$info, self::$except, $list);
     }
 }
开发者ID:Gerdie,项目名称:dreamy-wedding-company,代码行数:12,代码来源:tpl_module.php


示例15: metaBoxTemplateAreas

 /**
  * Template areas meta box
  * @return void
  */
 public function metaBoxTemplateAreas()
 {
     global $wp_registered_sidebars;
     global $modularityOptions;
     usort($wp_registered_sidebars, function ($a, $b) {
         return $a['name'] > $b['name'];
     });
     $coreTemplates = \Modularity\Helper\Wp::getCoreTemplates();
     $coreTemplates = apply_filters('Modularity/CoreTemplatesInTheme', $coreTemplates);
     $customTemplates = get_page_templates();
     $templates = array_merge($coreTemplates, $customTemplates);
     include MODULARITY_TEMPLATE_PATH . 'options/partials/modularity-template-areas.php';
 }
开发者ID:helsingborg-stad,项目名称:Modularity,代码行数:17,代码来源:General.php


示例16: cached_page_template_drowpdown

 /**
  * Inspired from \wp-admin\includes\theme.php::page_template_drowpdown() :
  * Changes $templates to static because when the function is called for each displayed pages,
  * it leads to very bad perfomances...
  */
 function cached_page_template_drowpdown($default)
 {
     static $templates = array();
     $display_template = __('Default Template', ApmConfig::i18n_domain);
     if (empty($templates)) {
         $templates = get_page_templates();
     }
     ksort($templates);
     foreach (array_keys($templates) as $template) {
         if ($default == $templates[$template]) {
             $display_template = $template;
         }
     }
     echo $display_template;
 }
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:20,代码来源:functions.php


示例17: createPageTemplate

 /**
  * [createPageTemplate description]
  * @return [type] [description]
  */
 public static function createPageTemplate()
 {
     /* Injeta um item no cache de templates para garantir que o dropdown seja
      * mostrado. Ainda é necessário o javascript porque podemos apenas
      * sobreescrever as opções, não adicionar. */
     if (!count(get_page_templates())) {
         $cacheKey = 'page_templates-' . md5(get_theme_root() . '/' . get_stylesheet());
         wp_cache_set($cacheKey, array('mobilize_force_dropdown' => 'mobilize_force_dropdown'), 'themes', 1800);
     }
     wp_enqueue_script('mobilize-edit', plugins_url('/mobilize/assets/js/edit.js', INC_MOBILIZE));
     $slug = get_post_meta(get_the_ID(), '_mobilize_template', true);
     wp_localize_script('mobilize-edit', 'templateData', array('slug' => $slug));
     if ($slug === 'mobilize') {
         $layout = self::getPageLayout(get_the_ID());
         require INC_MOBILIZE . '/includes/page_edit.php';
     }
 }
开发者ID:cabelotaina,项目名称:redelivre,代码行数:21,代码来源:vendor.php


示例18: setUp

 public function setUp()
 {
     $template_files = get_page_templates();
     //get all available templates file
     $templates_field_data = array('' => '--- Chọn ---');
     //list all templates select tag
     //prepare fields
     foreach ($template_files as $name => $file) {
         $templates_field_data[$file] = $name;
     }
     $this->addSettingFields(array('field_id' => 'enable', 'type' => 'checkbox', 'title' => 'Kích hoạt', 'description' => 'Kích hoạt thay đổi template.'), array('field_id' => 'query_data_and', 'type' => 'hw_condition_rules', 'title' => __('Dàng buộc AND'), 'description' => 'Thêm điều kiện lọc AND.', 'repeatable' => true), array('field_id' => 'query_data_or', 'type' => 'hw_condition_rules', 'title' => __('Dàng buộc OR'), 'description' => 'Thêm điều kiện lọc OR.', 'repeatable' => true), array('field_id' => 'template', 'type' => 'select', 'title' => "Template", 'description' => 'Chọn template chuyển hướng. Chú ý: các file template khai báo tên, nằm trong thư mục theme hiện tại và có thể nằm thư mục con.', 'label' => &$templates_field_data));
     if (isset($apf_fields) && count($apf_fields)) {
         foreach ($apf_fields as $field_setting) {
             $this->addSettingField($field_setting);
         }
     }
     // content_{page slug}_{tab slug}
     //add_filter( 'content_hw_templates_settings', array( $this, 'replyToInsertContents' ) );
 }
开发者ID:hoangsoft90,项目名称:hw-hoangweb-plugin,代码行数:19,代码来源:dynamic-templates-metabox.php


示例19: pt_parse_query

 public function pt_parse_query($query)
 {
     global $pagenow, $post_type;
     if ('edit.php' != $pagenow) {
         return;
     }
     switch ($post_type) {
         case 'post':
             break;
         case 'page':
             $this->templates = get_page_templates();
             if (empty($this->templates)) {
                 return;
             }
             if (!$this->is_set_template()) {
                 return;
             }
             $meta_group = array('key' => '_wp_page_template', 'value' => $this->get_template());
             set_query_var('meta_query', array($meta_group));
             break;
     }
 }
开发者ID:Kilbourne,项目名称:restart,代码行数:22,代码来源:class-pages-filter-by-template.php


示例20: wp_getPageTemplates

 /**
  * Retrieve page templates.
  *
  * @since 2.6.0
  *
  * @param array $args Method parameters.
  * @return array|IXR_Error
  */
 public function wp_getPageTemplates($args)
 {
     $this->escape($args);
     $username = $args[1];
     $password = $args[2];
     if (!($user = $this->login($username, $password))) {
         return $this->error;
     }
     if (!current_user_can('edit_pages')) {
         return new IXR_Error(403, __('You are not allowed access to details about this site.'));
     }
     $templates = get_page_templates();
     $templates['Default'] = 'default';
     return $templates;
 }
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:23,代码来源:class-wp-xmlrpc-server.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_page_title函数代码示例发布时间:2022-05-15
下一篇:
PHP get_page_template_slug函数代码示例发布时间: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