当前位置: 首页>>代码示例>>PHP>>正文


PHP get_page_templates函数代码示例

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


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


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