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

PHP get_all_post_type_supports函数代码示例

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

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



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

示例1: remove_post_type_support

 /**
  * List post type support values given a list of values to support.
  *
  * Typically needed for 'post' and 'page'.
  *
  * @param string[] $to_remove
  */
 static function remove_post_type_support($to_remove)
 {
     if (!is_array($to_remove)) {
         $to_remove = array($to_remove);
     }
     $supports = array_diff(array_keys(get_all_post_type_supports(static::POST_TYPE)), $to_remove);
     foreach ($supports as $support) {
         remove_post_type_support(static::POST_TYPE, $support);
     }
 }
开发者ID:wpscholar,项目名称:wplib,代码行数:17,代码来源:class-post-module-base.php


示例2: test_add_supports_custom

 public function test_add_supports_custom()
 {
     $post_type = rand_str();
     $post_type_object = new WP_Post_Type($post_type, array('supports' => array('editor', 'comments', 'revisions')));
     $post_type_object->add_supports();
     $post_type_supports = get_all_post_type_supports($post_type);
     $post_type_object->remove_supports();
     $post_type_supports_after = get_all_post_type_supports($post_type);
     $this->assertEqualSets(array('editor' => true, 'comments' => true, 'revisions' => true), $post_type_supports);
     $this->assertEqualSets(array(), $post_type_supports_after);
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:11,代码来源:wpPostType.php


示例3: post_type_supports_byline

 /**
  * Does the post type support this byline type?
  */
 public function post_type_supports_byline($post_type, $type)
 {
     if (current_theme_supports('bylines')) {
         $byline_types = get_theme_support('bylines');
         if (in_array($type, reset($byline_types))) {
             $post_type_supports = get_all_post_type_supports($post_type);
             if (in_array($type, array_keys($post_type_supports))) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:alleyinteractive,项目名称:fieldmanager-bylines,代码行数:16,代码来源:class-fm-bylines-post.php


示例4: callback

 function callback($path = '', $blog_id = 0)
 {
     $blog_id = $this->api->switch_to_blog_and_validate_user($this->api->get_blog_id($blog_id));
     if (is_wp_error($blog_id)) {
         return $blog_id;
     }
     if (defined('IS_WPCOM') && IS_WPCOM) {
         $this->load_theme_functions();
     }
     $args = $this->query_args();
     /**
      * Whether API responses should be returned in a custom locale.  False
      * for Jetpack; may be true for WP.com requests.
      *
      * @since 3.9.2
      */
     if (apply_filters('rest_api_localize_response', false)) {
         // API localization occurs after the initial post types have been
         // registered, so re-register if localizing response
         create_initial_post_types();
     }
     $queryable_only = isset($args['api_queryable']) && $args['api_queryable'];
     // Get a list of available post types
     $post_types = get_post_types(array('public' => true));
     $formatted_post_type_objects = array();
     // Retrieve post type object for each post type
     foreach ($post_types as $post_type) {
         // Skip non-queryable if filtering on queryable only
         $is_queryable = $this->is_post_type_allowed($post_type);
         if ($queryable_only && !$is_queryable) {
             continue;
         }
         $post_type_object = get_post_type_object($post_type);
         $formatted_post_type_object = array();
         // Include only the desired keys in the response
         foreach (self::$post_type_keys_to_include as $key => $value) {
             $formatted_post_type_object[$value] = $post_type_object->{$key};
         }
         $formatted_post_type_object['api_queryable'] = $is_queryable;
         $formatted_post_type_object['supports'] = get_all_post_type_supports($post_type);
         if ($this->post_type_supports_tags($post_type)) {
             $formatted_post_type_object['supports']['tags'] = true;
         }
         $formatted_post_type_objects[] = $formatted_post_type_object;
     }
     return array('found' => count($formatted_post_type_objects), 'post_types' => $formatted_post_type_objects);
 }
开发者ID:kanei,项目名称:vantuch.cz,代码行数:47,代码来源:class.wpcom-json-api-list-post-types-endpoint.php


示例5: _prepare_post_type

 /**
  * Prepares post data for return in an XML-RPC object.
  *
  * @access protected
  *
  * @param object $post_type Post type object
  * @param array $fields The subset of post fields to return
  * @return array The prepared post type data
  */
 protected function _prepare_post_type($post_type, $fields)
 {
     $_post_type = array('name' => $post_type->name, 'label' => $post_type->label, 'hierarchical' => (bool) $post_type->hierarchical, 'public' => (bool) $post_type->public, 'show_ui' => (bool) $post_type->show_ui, '_builtin' => (bool) $post_type->_builtin, 'has_archive' => (bool) $post_type->has_archive, 'supports' => get_all_post_type_supports($post_type->name));
     if (in_array('labels', $fields)) {
         $_post_type['labels'] = (array) $post_type->labels;
     }
     if (in_array('cap', $fields)) {
         $_post_type['cap'] = (array) $post_type->cap;
         $_post_type['map_meta_cap'] = (bool) $post_type->map_meta_cap;
     }
     if (in_array('menu', $fields)) {
         $_post_type['menu_position'] = (int) $post_type->menu_position;
         $_post_type['menu_icon'] = $post_type->menu_icon;
         $_post_type['show_in_menu'] = (bool) $post_type->show_in_menu;
     }
     if (in_array('taxonomies', $fields)) {
         $_post_type['taxonomies'] = get_object_taxonomies($post_type->name, 'names');
     }
     /**
      * Filter XML-RPC-prepared date for the given post type.
      *
      * @since 3.4.0
      *
      * @param array  $_post_type An array of post type data.
      * @param object $post_type  Post type object.
      */
     return apply_filters('xmlrpc_prepare_post_type', $_post_type, $post_type);
 }
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:37,代码来源:class-wp-xmlrpc-server.php


示例6: _prepare_post_type

 /**
  * Prepares post data for return in an XML-RPC object.
  *
  * @access protected
  *
  * @param object $post_type Post type object
  * @param array $fields The subset of post fields to return
  * @return array The prepared post type data
  */
 protected function _prepare_post_type($post_type, $fields)
 {
     $_post_type = array('name' => $post_type->name, 'label' => $post_type->label, 'hierarchical' => (bool) $post_type->hierarchical, 'public' => (bool) $post_type->public, 'show_ui' => (bool) $post_type->show_ui, '_builtin' => (bool) $post_type->_builtin, 'has_archive' => (bool) $post_type->has_archive, 'supports' => get_all_post_type_supports($post_type->name));
     if (in_array('labels', $fields)) {
         $_post_type['labels'] = (array) $post_type->labels;
     }
     if (in_array('cap', $fields)) {
         $_post_type['cap'] = (array) $post_type->cap;
         $_post_type['map_meta_cap'] = (bool) $post_type->map_meta_cap;
     }
     if (in_array('menu', $fields)) {
         $_post_type['menu_position'] = (int) $post_type->menu_position;
         $_post_type['menu_icon'] = $post_type->menu_icon;
         $_post_type['show_in_menu'] = (bool) $post_type->show_in_menu;
     }
     if (in_array('taxonomies', $fields)) {
         $_post_type['taxonomies'] = get_object_taxonomies($post_type->name, 'names');
     }
     return apply_filters('xmlrpc_prepare_post_type', $_post_type, $post_type);
 }
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:29,代码来源:class-wp-xmlrpc-server.php


示例7: callback

 function callback($path = '', $blog_id = 0)
 {
     $blog_id = $this->api->switch_to_blog_and_validate_user($this->api->get_blog_id($blog_id));
     if (is_wp_error($blog_id)) {
         return $blog_id;
     }
     if (defined('IS_WPCOM') && IS_WPCOM) {
         $this->load_theme_functions();
     }
     $args = $this->query_args();
     $queryable_only = isset($args['api_queryable']) && $args['api_queryable'];
     // Get a list of available post types
     $post_types = get_post_types(array('public' => true));
     $formatted_post_type_objects = array();
     // Retrieve post type object for each post type
     foreach ($post_types as $post_type) {
         // Skip non-queryable if filtering on queryable only
         $is_queryable = $this->is_post_type_allowed($post_type);
         if ($queryable_only && !$is_queryable) {
             continue;
         }
         $post_type_object = get_post_type_object($post_type);
         $formatted_post_type_object = array();
         // Include only the desired keys in the response
         foreach (self::$post_type_keys_to_include as $key => $value) {
             $formatted_post_type_object[$value] = $post_type_object->{$key};
         }
         $formatted_post_type_object['api_queryable'] = $is_queryable;
         $formatted_post_type_object['supports'] = get_all_post_type_supports($post_type);
         $formatted_post_type_objects[] = $formatted_post_type_object;
     }
     return array('found' => count($formatted_post_type_objects), 'post_types' => $formatted_post_type_objects);
 }
开发者ID:rbryerking,项目名称:skillcrush-wordpress,代码行数:33,代码来源:class.wpcom-json-api-get-site-endpoint.php


示例8: set_page_builder

 public function set_page_builder()
 {
     if (current_theme_supports('bon-page-builder') && class_exists('BON_Main')) {
         $bon_toolkit_options = get_option($this->option_name);
         $builder_options = isset($bon_toolkit_options['page_builder_post_type']) ? $bon_toolkit_options['page_builder_post_type'] : '';
         $builder_support = get_theme_support('bon-page-builder');
         if (is_array($builder_options) && !empty($builder_options)) {
             $this->builder_post_types = $builder_options;
         } else {
             if (!empty($builder_support[0])) {
                 $this->builder_post_types = array_merge($this->builder_post_types, $builder_support[0]);
             }
             $post_types = get_post_types(array('public' => true));
             foreach ($post_types as $type) {
                 $post_type_supports = get_all_post_type_supports($type);
                 if (!empty($post_type_supports) && array_key_exists('bon-page-builder', $post_type_supports) && !in_array($type, $this->builder_post_types)) {
                     $this->builder_post_types[] = $type;
                 }
             }
         }
         include_once 'includes/builder/builder-options.php';
         include_once 'includes/builder/builder.php';
         include_once 'includes/builder/builder-interface.php';
     }
 }
开发者ID:alexszilagyi,项目名称:bon-toolkit,代码行数:25,代码来源:bon-toolkit.php


示例9: _prepare_post_type

 /**
  * Prepares post data for return in an XML-RPC object.
  *
  * @access protected
  *
  * @param array|object $post_type The unprepared post type data
  * @param array $fields The subset of post fields to return
  * @return array The prepared post type data
  */
 protected function _prepare_post_type($post_type, $fields)
 {
     $post_type = (array) $post_type;
     $_post_type = array('name' => $post_type['name'], 'label' => $post_type['label'], 'description' => $post_type['description'], 'hierarchical' => $post_type['hierarchical'], 'public' => $post_type['public'], '_builtin' => $post_type['_builtin'], 'supports' => get_all_post_type_supports($post_type['name']));
     if (in_array('labels', $fields)) {
         $_post_type['labels'] = (array) $post_type['labels'];
     }
     if (in_array('capabilities', $fields)) {
         $_post_type['cap'] = (array) $post_type['cap'];
         $_post_type['capability_type'] = $post_type['capability_type'];
         $_post_type['map_meta_cap'] = $post_type['map_meta_cap'];
     }
     if (in_array('admin', $fields)) {
         $_post_type['publicly_queryable'] = $post_type['publicly_queryable'];
         $_post_type['exclude_from_search'] = $post_type['exclude_from_search'];
         $_post_type['_edit_link'] = $post_type['_edit_link'];
         $_post_type['rewrite'] = $post_type['rewrite'];
         $_post_type['has_archive'] = $post_type['has_archive'];
         $_post_type['query_var'] = $post_type['query_var'];
     }
     if (in_array('menu', $fields)) {
         $_post_type['show_ui'] = $post_type['show_ui'];
         $_post_type['menu_position'] = $post_type['menu_position'];
         $_post_type['menu_icon'] = $post_type['menu_icon'];
         $_post_type['show_in_nav_menus'] = $post_type['show_in_nav_menus'];
         $_post_type['show_in_menu'] = $post_type['show_in_menu'];
         $_post_type['show_in_admin_bar'] = $post_type['show_in_admin_bar'];
     }
     if (in_array('taxonomies', $fields)) {
         $_post_type['taxonomies'] = get_object_taxonomies($_post_type['name']);
     }
     return apply_filters('xmlrpc_prepare_post_type', $_post_type, $post_type);
 }
开发者ID:radman,项目名称:noobyo-blog,代码行数:42,代码来源:class-wp-xmlrpc-server.php


示例10: map_to_dropdown

    function map_to_dropdown()
    {
        global $wpdb;
        $dont_allow = array('_wp_attachment_image_alt', '_wp_attachment_metadata', '_wp_attached_file', '_edit_lock', '_edit_last', '_wp_page_template');
        $html = '
			<li data-post-type="all" class="live_filter">
				<input type="text" class="live_filter" placeholder="' . esc_attr($this->__('Search... ')) . '" />
			</li>';
        $field_groups = array();
        $supports_custom = array();
        $yoast_field_type_array = array('text', 'textarea', 'select', 'upload', 'radio', 'multiselect');
        $yoast = false;
        if (function_exists('wpseo_admin_init')) {
            $this->_initialize_yoast();
            $yoast = true;
        }
        $yoast_prefix = '_yoast_wpseo_';
        $yoast_fields = array();
        foreach ($this->post_types as $name => $title) {
            $supports = get_all_post_type_supports($name);
            if (isset($supports['custom-fields'])) {
                $supports_custom[] = $name;
            }
            if ($name == 'attachment') {
                $html .= '
			<li data-post-type="|attachment|" data-search="' . esc_attr($this->__('Title')) . '">
				<a href="#" data-value="post_title">' . $this->__('Title') . '</a>
			</li>
			<li data-post-type="|attachment|" data-search="' . esc_attr($this->__('Caption')) . '">
				<a href="#" data-value="post_excerpt">' . $this->__('Caption') . '</a>
			</li>
			<li data-post-type="|attachment|" data-search="' . esc_attr($this->__('Description')) . '">
				<a href="#" data-value="post_content">' . $this->__('Description') . '</a>
			</li>
			<li data-post-type="|attachment|" data-search="' . esc_attr($this->__('Alt Text')) . '">
				<a href="#" data-value="_wp_attachment_image_alt">' . $this->__('Alt Text') . '</a>
			</li>';
            } else {
                $labels = array('title' => sprintf($this->__('%s Title'), $title), 'editor' => sprintf($this->__('%s Content'), $title), 'excerpt' => sprintf($this->__('%s Excerpt'), $title), 'thumbnail' => $this->__('Featured Image'), 'tags' => $this->__('Tags'), 'cats' => $this->__('Category'), 'author' => $this->__('Author'));
                $fields = array('editor' => 'post_content', 'title' => 'post_title', 'excerpt' => 'post_excerpt', 'thumbnail' => 'gc_featured_image_', 'author' => 'post_author');
                foreach ($fields as $type => $fieldname) {
                    if (isset($supports[$type])) {
                        $html .= '
			<li data-post-type="|' . $name . '|" data-search="' . esc_attr($labels[$type]) . '">
				<a href="#" data-value="' . $fieldname . '">' . esc_html($labels[$type]) . '</a>
			</li>';
                    }
                }
                if (count($this->taxonomies[$name]) > 0) {
                    $html .= '
			<li data-post-type="|' . $name . '|" data-search="' . esc_attr($labels['cats']) . '">
				<a href="#" data-value="gc_post_cat_">' . esc_html($labels['cats']) . '</a>
			</li>';
                }
                if (isset($this->allows_tags[$name])) {
                    $html .= '
			<li data-post-type="|' . $name . '|" data-search="' . esc_attr($labels['tags']) . '">
				<a href="#" data-value="gc_post_tags_">' . esc_html($labels['tags']) . '</a>
			</li>';
                }
            }
            if ($this->has_acf) {
                $acf = $this->_acf_get_field_groups(array('post_type' => $name));
                foreach ($acf as $post_id) {
                    if (!isset($field_groups[$post_id])) {
                        $field_groups[$post_id] = array('types' => array(), 'posts' => array());
                    }
                    $field_groups[$post_id]['types'][] = $name;
                    $field_groups[$post_id]['posts'][] = 0;
                }
                foreach ($this->page_ids[$name] as $page_id) {
                    $acf = $this->_acf_get_field_groups(array('post_id' => $page_id));
                    foreach ($acf as $post_id) {
                        if (!isset($field_groups[$post_id])) {
                            $field_groups[$post_id] = array('posts' => array());
                        } elseif (!isset($field_groups[$post_id]['posts'])) {
                            $field_groups[$post_id]['posts'] = array();
                        }
                        $field_groups[$post_id]['posts'][] = $page_id;
                    }
                }
            }
            if ($yoast) {
                $meta_boxes = array_merge(WPSEO_Meta::get_meta_field_defs('general', $name), WPSEO_Meta::get_meta_field_defs('advanced'), apply_filters('wpseo_save_metaboxes', array()));
                foreach ($meta_boxes as $field_name => $meta_box) {
                    if (in_array($meta_box['type'], $yoast_field_type_array)) {
                        $yoast_fields[$yoast_prefix . $field_name] = true;
                        $html .= '
			<li data-post-type="|' . $name . '|" data-search="' . esc_attr($meta_box['title']) . '">
				<a href="#" data-value="' . $yoast_prefix . esc_attr($field_name) . '">' . esc_html($meta_box['title']) . '</a>
			</li>';
                    }
                }
            }
        }
        foreach ($field_groups as $id => $options) {
            $options['posts'] = array_unique($options['posts']);
            if ($this->acf_pro) {
                $fields = acf_get_fields($id);
            } else {
//.........这里部分代码省略.........
开发者ID:shellygraham,项目名称:tag,代码行数:101,代码来源:curl.php


示例11: appthemes_page_attributes_meta_box

function appthemes_page_attributes_meta_box($post)
{
    $post_type_object = get_post_type_object($post->post_type);
    $post_type_supports = get_all_post_type_supports($post->post_type);
    if ($post_type_object->hierarchical && !$post_type_supports['appthemes_page_attributes'][0]['hide_page_parent']) {
        $dropdown_args = array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)', APP_TD), 'sort_column' => 'menu_order, post_title', 'echo' => 0);
        $dropdown_args = apply_filters('page_attributes_dropdown_pages_args', $dropdown_args, $post);
        $pages = wp_dropdown_pages($dropdown_args);
        if (!empty($pages)) {
            ?>
			<p><strong><?php 
            _e('Parent', APP_TD);
            ?>
</strong></p>
			<label class="screen-reader-text" for="parent_id"><?php 
            _e('Parent', APP_TD);
            ?>
</label>
			<?php 
            echo $pages;
            ?>
		<?php 
        }
        // end empty pages check
    }
    // end hierarchical check.
    if ('page' == $post->post_type && 0 != count(get_page_templates())) {
        $current_template = !empty($post->page_template) ? $post->page_template : false;
        if ($post_type_supports['appthemes_page_attributes'][0]['internal_use_only']) {
            // This is an internal use page, need to keep the page template locked and don't even offer dropdown
            appthemes_fixed_page_template($post);
        } else {
            ?>
			<p><strong><?php 
            _e('Template', APP_TD);
            ?>
</strong></p>
			<label class="screen-reader-text" for="page_template"><?php 
            _e('Page Template', APP_TD);
            ?>
</label>
			<select name="page_template" id="page_template">
			<option value='default'><?php 
            _e('Default Template', APP_TD);
            ?>
</option>
			<?php 
            $templates = get_page_templates();
            ksort($templates);
            // Take out appthemes internal use templates
            foreach ($templates as $name => $template) {
                if (in_array($template, $post_type_supports['appthemes_internal_use_page_templates'][0])) {
                    unset($templates[$name]);
                }
            }
            foreach (array_keys($templates) as $template) {
                if ($current_template == $templates[$template]) {
                    $selected = " selected='selected'";
                } else {
                    $selected = '';
                }
                echo "\n\t<option value='" . $templates[$template] . "' {$selected}>{$template}</option>";
            }
            ?>
			</select>
			<?php 
        }
    }
    if (!$post_type_supports['appthemes_page_attributes'][0]['hide_page_order']) {
        ?>
	<p><strong><?php 
        _e('Order', APP_TD);
        ?>
</strong></p>
	<p><label class="screen-reader-text" for="menu_order"><?php 
        _e('Order', APP_TD);
        ?>
</label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php 
        echo esc_attr($post->menu_order);
        ?>
" /></p>
	<p><?php 
        if ('page' == $post->post_type) {
            _e('Need help? Use the Help tab in the upper right of your screen.', APP_TD);
        }
        ?>
</p>
	<?php 
    }
}
开发者ID:TopLineMediaTeam,项目名称:horseshow,代码行数:90,代码来源:view-types.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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