本文整理汇总了PHP中get_post_type_labels函数的典型用法代码示例。如果您正苦于以下问题:PHP get_post_type_labels函数的具体用法?PHP get_post_type_labels怎么用?PHP get_post_type_labels使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_post_type_labels函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: register_post_type
//.........这里部分代码省略.........
if (null === $args->map_meta_cap) {
$args->map_meta_cap = false;
}
// If there's no specified edit link and no UI, remove the edit link.
if (!$args->show_ui && !$has_edit_link) {
$args->_edit_link = '';
}
$args->cap = get_post_type_capabilities($args);
unset($args->capabilities);
if (is_array($args->capability_type)) {
$args->capability_type = $args->capability_type[0];
}
if (!empty($args->supports)) {
add_post_type_support($post_type, $args->supports);
unset($args->supports);
} elseif (false !== $args->supports) {
// Add default features
add_post_type_support($post_type, array('title', 'editor'));
}
if (false !== $args->query_var) {
if (true === $args->query_var) {
$args->query_var = $post_type;
} else {
$args->query_var = sanitize_title_with_dashes($args->query_var);
}
if ($wp && is_post_type_viewable($args)) {
$wp->add_query_var($args->query_var);
}
}
if (false !== $args->rewrite && (is_admin() || '' != get_option('permalink_structure'))) {
if (!is_array($args->rewrite)) {
$args->rewrite = array();
}
if (empty($args->rewrite['slug'])) {
$args->rewrite['slug'] = $post_type;
}
if (!isset($args->rewrite['with_front'])) {
$args->rewrite['with_front'] = true;
}
if (!isset($args->rewrite['pages'])) {
$args->rewrite['pages'] = true;
}
if (!isset($args->rewrite['feeds']) || !$args->has_archive) {
$args->rewrite['feeds'] = (bool) $args->has_archive;
}
if (!isset($args->rewrite['ep_mask'])) {
if (isset($args->permalink_epmask)) {
$args->rewrite['ep_mask'] = $args->permalink_epmask;
} else {
$args->rewrite['ep_mask'] = EP_PERMALINK;
}
}
if ($args->hierarchical) {
add_rewrite_tag("%{$post_type}%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type={$post_type}&pagename=");
} else {
add_rewrite_tag("%{$post_type}%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type={$post_type}&name=");
}
if ($args->has_archive) {
$archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive;
if ($args->rewrite['with_front']) {
$archive_slug = substr($wp_rewrite->front, 1) . $archive_slug;
} else {
$archive_slug = $wp_rewrite->root . $archive_slug;
}
add_rewrite_rule("{$archive_slug}/?\$", "index.php?post_type={$post_type}", 'top');
if ($args->rewrite['feeds'] && $wp_rewrite->feeds) {
$feeds = '(' . trim(implode('|', $wp_rewrite->feeds)) . ')';
add_rewrite_rule("{$archive_slug}/feed/{$feeds}/?\$", "index.php?post_type={$post_type}" . '&feed=$matches[1]', 'top');
add_rewrite_rule("{$archive_slug}/{$feeds}/?\$", "index.php?post_type={$post_type}" . '&feed=$matches[1]', 'top');
}
if ($args->rewrite['pages']) {
add_rewrite_rule("{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?\$", "index.php?post_type={$post_type}" . '&paged=$matches[1]', 'top');
}
}
$permastruct_args = $args->rewrite;
$permastruct_args['feed'] = $permastruct_args['feeds'];
add_permastruct($post_type, "{$args->rewrite['slug']}/%{$post_type}%", $permastruct_args);
}
// Register the post type meta box if a custom callback was specified.
if ($args->register_meta_box_cb) {
add_action('add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1);
}
$args->labels = get_post_type_labels($args);
$args->label = $args->labels->name;
$wp_post_types[$post_type] = $args;
add_action('future_' . $post_type, '_future_post_hook', 5, 2);
foreach ($args->taxonomies as $taxonomy) {
register_taxonomy_for_object_type($taxonomy, $post_type);
}
/**
* Fires after a post type is registered.
*
* @since 3.3.0
*
* @param string $post_type Post type.
* @param object $args Arguments used to register the post type.
*/
do_action('registered_post_type', $post_type, $args);
return $args;
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:101,代码来源:post.php
示例2: register_post_type
//.........这里部分代码省略.........
$args = wp_parse_args($args, $defaults);
$args = (object) $args;
$post_type = sanitize_key($post_type);
$args->name = $post_type;
if (strlen($post_type) > 20) {
return new WP_Error('post_type_too_long', __('Post types cannot exceed 20 characters in length'));
}
// If not set, default to the setting for public.
if (null === $args->publicly_queryable) {
$args->publicly_queryable = $args->public;
}
// If not set, default to the setting for public.
if (null === $args->show_ui) {
$args->show_ui = $args->public;
}
// If not set, default to the setting for show_ui.
if (null === $args->show_in_menu || !$args->show_ui) {
$args->show_in_menu = $args->show_ui;
}
// Whether to show this type in nav-menus.php. Defaults to the setting for public.
if (null === $args->show_in_nav_menus) {
$args->show_in_nav_menus = $args->public;
}
// If not set, default to true if not public, false if public.
if (null === $args->exclude_from_search) {
$args->exclude_from_search = !$args->public;
}
// Back compat with quirky handling in version 3.0. #14122
if (empty($args->capabilities) && null === $args->map_meta_cap && in_array($args->capability_type, array('post', 'page'))) {
$args->map_meta_cap = true;
}
if (null === $args->map_meta_cap) {
$args->map_meta_cap = false;
}
$args->cap = get_post_type_capabilities($args);
unset($args->capabilities);
if (is_array($args->capability_type)) {
$args->capability_type = $args->capability_type[0];
}
if (!empty($args->supports)) {
add_post_type_support($post_type, $args->supports);
unset($args->supports);
} else {
// Add default features
add_post_type_support($post_type, array('title', 'editor'));
}
if (false !== $args->query_var && !empty($wp)) {
if (true === $args->query_var) {
$args->query_var = $post_type;
}
$args->query_var = sanitize_title_with_dashes($args->query_var);
$wp->add_query_var($args->query_var);
}
if (false !== $args->rewrite && '' != get_option('permalink_structure')) {
if (!is_array($args->rewrite)) {
$args->rewrite = array();
}
if (empty($args->rewrite['slug'])) {
$args->rewrite['slug'] = $post_type;
}
if (!isset($args->rewrite['with_front'])) {
$args->rewrite['with_front'] = true;
}
if (!isset($args->rewrite['pages'])) {
$args->rewrite['pages'] = true;
}
if (!isset($args->rewrite['feeds']) || !$args->has_archive) {
$args->rewrite['feeds'] = (bool) $args->has_archive;
}
if ($args->hierarchical) {
$wp_rewrite->add_rewrite_tag("%{$post_type}%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type={$post_type}&name=");
} else {
$wp_rewrite->add_rewrite_tag("%{$post_type}%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type={$post_type}&name=");
}
if ($args->has_archive) {
$archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive;
$wp_rewrite->add_rule("{$archive_slug}/?\$", "index.php?post_type={$post_type}", 'top');
if ($args->rewrite['feeds'] && $wp_rewrite->feeds) {
$feeds = '(' . trim(implode('|', $wp_rewrite->feeds)) . ')';
$wp_rewrite->add_rule("{$archive_slug}/feed/{$feeds}/?\$", "index.php?post_type={$post_type}" . '&feed=$matches[1]', 'top');
$wp_rewrite->add_rule("{$archive_slug}/{$feeds}/?\$", "index.php?post_type={$post_type}" . '&feed=$matches[1]', 'top');
}
if ($args->rewrite['pages']) {
$wp_rewrite->add_rule("{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?\$", "index.php?post_type={$post_type}" . '&paged=$matches[1]', 'top');
}
}
$wp_rewrite->add_permastruct($post_type, "{$args->rewrite['slug']}/%{$post_type}%", $args->rewrite['with_front'], $args->permalink_epmask);
}
if ($args->register_meta_box_cb) {
add_action('add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1);
}
$args->labels = get_post_type_labels($args);
$args->label = $args->labels->name;
$wp_post_types[$post_type] = $args;
add_action('future_' . $post_type, '_future_post_hook', 5, 2);
foreach ($args->taxonomies as $taxonomy) {
register_taxonomy_for_object_type($taxonomy, $post_type);
}
return $args;
}
开发者ID:BGCX261,项目名称:zombie-craft-svn-to-git,代码行数:101,代码来源:post.php
示例3: register_post_type
//.........这里部分代码省略.........
* - menu_position - The position in the menu order the post type should appear. Defaults to the bottom.
* - menu_icon - The url to the icon to be used for this menu. Defaults to use the posts icon.
* - capability_type - The post type to use for checking read, edit, and delete capabilities. Defaults to "post".
* - capabilities - Array of capabilities for this post type. You can see accepted values in {@link get_post_type_capabilities()}. By default the capability_type is used to construct capabilities.
* - hierarchical - Whether the post type is hierarchical. Defaults to false.
* - supports - An alias for calling add_post_type_support() directly. See add_post_type_support() for Documentation. Defaults to none.
* - register_meta_box_cb - Provide a callback function that will be called when setting up the meta boxes for the edit form. Do remove_meta_box() and add_meta_box() calls in the callback.
* - taxonomies - An array of taxonomy identifiers that will be registered for the post type. Default is no taxonomies. Taxonomies can be registered later with register_taxonomy() or register_taxonomy_for_object_type().
* - labels - An array of labels for this post type. You can see accepted values in {@link get_post_type_labels()}. By default post labels are used for non-hierarchical types and page labels for hierarchical ones.
* - permalink_epmask - The default rewrite endpoint bitmasks.
* - rewrite - false to prevent rewrite, or array('slug'=>$slug) to customize permastruct; default will use $post_type as slug.
* - query_var - false to prevent queries, or string to value of the query var to use for this post type
* - can_export - true allows this post type to be exported.
* - show_in_nav_menus - true makes this post type available for selection in navigation menus.
* - _builtin - true if this post type is a native or "built-in" post_type. THIS IS FOR INTERNAL USE ONLY!
* - _edit_link - URL segement to use for edit link of this post type. Set to 'post.php?post=%d'. THIS IS FOR INTERNAL USE ONLY!
*
* @since 2.9.0
* @uses $wp_post_types Inserts new post type object into the list
*
* @param string $post_type Name of the post type.
* @param array|string $args See above description.
* @return object the registered post type object
*/
function register_post_type($post_type, $args = array())
{
global $wp_post_types, $wp_rewrite, $wp;
if (!is_array($wp_post_types)) {
$wp_post_types = array();
}
// Args prefixed with an underscore are reserved for internal use.
$defaults = array('labels' => array(), 'description' => '', 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'capabilities' => array(), 'hierarchical' => false, 'public' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null, 'permalink_epmask' => EP_PERMALINK, 'can_export' => true, 'show_in_nav_menus' => null);
$args = wp_parse_args($args, $defaults);
$args = (object) $args;
$post_type = sanitize_user($post_type, true);
$args->name = $post_type;
// If not set, default to the setting for public.
if (null === $args->publicly_queryable) {
$args->publicly_queryable = $args->public;
}
// If not set, default to the setting for public.
if (null === $args->show_ui) {
$args->show_ui = $args->public;
}
// Whether to show this type in nav-menus.php. Defaults to the setting for public.
if (null === $args->show_in_nav_menus) {
$args->show_in_nav_menus = $args->public;
}
// If not set, default to true if not public, false if public.
if (null === $args->exclude_from_search) {
$args->exclude_from_search = !$args->public;
}
if (empty($args->capability_type)) {
$args->capability_type = 'post';
}
$args->cap = get_post_type_capabilities($args);
unset($args->capabilities);
if (!empty($args->supports)) {
add_post_type_support($post_type, $args->supports);
unset($args->supports);
} else {
// Add default features
add_post_type_support($post_type, array('title', 'editor'));
}
if (false !== $args->query_var && !empty($wp)) {
if (true === $args->query_var) {
$args->query_var = $post_type;
}
$args->query_var = sanitize_title_with_dashes($args->query_var);
$wp->add_query_var($args->query_var);
}
if (false !== $args->rewrite && '' != get_option('permalink_structure')) {
if (!is_array($args->rewrite)) {
$args->rewrite = array();
}
if (!isset($args->rewrite['slug'])) {
$args->rewrite['slug'] = $post_type;
}
if (!isset($args->rewrite['with_front'])) {
$args->rewrite['with_front'] = true;
}
if ($args->hierarchical) {
$wp_rewrite->add_rewrite_tag("%{$post_type}%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type={$post_type}&name=");
} else {
$wp_rewrite->add_rewrite_tag("%{$post_type}%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type={$post_type}&name=");
}
$wp_rewrite->add_permastruct($post_type, "{$args->rewrite['slug']}/%{$post_type}%", $args->rewrite['with_front'], $args->permalink_epmask);
}
if ($args->register_meta_box_cb) {
add_action('add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1);
}
$args->labels = get_post_type_labels($args);
$args->label = $args->labels->name;
$wp_post_types[$post_type] = $args;
add_action('future_' . $post_type, '_future_post_hook', 5, 2);
foreach ($args->taxonomies as $taxonomy) {
register_taxonomy_for_object_type($taxonomy, $post_type);
}
return $args;
}
开发者ID:owaismeo,项目名称:wordpress-10,代码行数:101,代码来源:post.php
示例4: test_get_post_type_object_casting
/**
* @ticket 33023
*/
public function test_get_post_type_object_casting()
{
register_post_type('foo');
$before = get_post_type_object('foo')->labels;
get_post_type_labels(get_post_type_object('foo'));
$after = get_post_type_object('foo')->labels;
$this->assertEquals($before, $after);
_unregister_post_type('foo');
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:12,代码来源:types.php
示例5: _e
</p>
</td>
</tr>
<tr>
<th scope="row">
<label><?php
_e('Configure Terms');
?>
</label>
</th>
<td>
<?php
foreach ($att_post_types as $pt) {
?>
<?php
$labels = get_post_type_labels(get_post_type_object($pt));
?>
<a target="_blank" href="<?php
echo esc_html(admin_url('edit-tags.php?taxonomy=' . $this->get_taxonomy_name($att_name) . '&post_type=' . $pt));
?>
" class="button configure-terms"><?php
echo $labels->name . ' ';
_e('Terms');
?>
</a>
<?php
}
?>
<p class="description"><?php
_e('Perform CRUD operations on Terms for this attribute.');
?>
开发者ID:codersantosh,项目名称:rt-lib,代码行数:31,代码来源:template-rt-edit-attribute.php
示例6: meta
private static function meta($object_id, $meta_key, $meta_value)
{
$prefix = WPSEO_Meta::$meta_prefix;
WPSEO_Metabox::translate_meta_boxes();
if (0 !== strpos($meta_key, $prefix)) {
return;
}
$key = str_replace($prefix, '', $meta_key);
foreach (WPSEO_Meta::$meta_fields as $tab => $fields) {
if (isset($fields[$key])) {
$field = $fields[$key];
break;
}
}
if (!isset($field, $field['title'], $tab) || '' === $field['title']) {
return;
}
$post = get_post($object_id);
$post_type_label = get_post_type_labels(get_post_type_object($post->post_type))->singular_name;
self::log(sprintf(__('Updated "%1$s" of "%2$s" %3$s', 'stream'), $field['title'], $post->post_title, $post_type_label), array('meta_key' => $meta_key, 'meta_value' => $meta_value, 'post_type' => $post->post_type), $object_id, 'wpseo_meta', 'updated');
}
开发者ID:Magnacarter,项目名称:livinghope.com,代码行数:21,代码来源:class-wp-stream-connector-wordpress-seo.php
示例7: set_props
//.........这里部分代码省略.........
* @since 4.6.0
* @access public
*
* @param array|string $args Array or string of arguments for registering a post type.
*/
public function set_props($args)
{
$args = wp_parse_args($args);
/**
* Filters the arguments for registering a post type.
*
* @since 4.4.0
*
* @param array $args Array of arguments for registering a post type.
* @param string $post_type Post type key.
*/
$args = apply_filters('register_post_type_args', $args, $this->name);
$has_edit_link = !empty($args['_edit_link']);
// Args prefixed with an underscore are reserved for internal use.
$defaults = array('labels' => array(), 'description' => '', 'public' => false, 'hierarchical' => false, 'exclude_from_search' => null, 'publicly_queryable' => null, 'show_ui' => null, 'show_in_menu' => null, 'show_in_nav_menus' => null, 'show_in_admin_bar' => null, 'menu_position' => null, 'menu_icon' => null, 'capability_type' => 'post', 'capabilities' => array(), 'map_meta_cap' => null, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array(), 'has_archive' => false, 'rewrite' => true, 'query_var' => true, 'can_export' => true, 'delete_with_user' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d');
$args = array_merge($defaults, $args);
$args['name'] = $this->name;
// If not set, default to the setting for public.
if (null === $args['publicly_queryable']) {
$args['publicly_queryable'] = $args['public'];
}
// If not set, default to the setting for public.
if (null === $args['show_ui']) {
$args['show_ui'] = $args['public'];
}
// If not set, default to the setting for show_ui.
if (null === $args['show_in_menu'] || !$args['show_ui']) {
$args['show_in_menu'] = $args['show_ui'];
}
// If not set, default to the whether the full UI is shown.
if (null === $args['show_in_admin_bar']) {
$args['show_in_admin_bar'] = (bool) $args['show_in_menu'];
}
// If not set, default to the setting for public.
if (null === $args['show_in_nav_menus']) {
$args['show_in_nav_menus'] = $args['public'];
}
// If not set, default to true if not public, false if public.
if (null === $args['exclude_from_search']) {
$args['exclude_from_search'] = !$args['public'];
}
// Back compat with quirky handling in version 3.0. #14122.
if (empty($args['capabilities']) && null === $args['map_meta_cap'] && in_array($args['capability_type'], array('post', 'page'))) {
$args['map_meta_cap'] = true;
}
// If not set, default to false.
if (null === $args['map_meta_cap']) {
$args['map_meta_cap'] = false;
}
// If there's no specified edit link and no UI, remove the edit link.
if (!$args['show_ui'] && !$has_edit_link) {
$args['_edit_link'] = '';
}
$this->cap = get_post_type_capabilities((object) $args);
unset($args['capabilities']);
if (is_array($args['capability_type'])) {
$args['capability_type'] = $args['capability_type'][0];
}
if (false !== $args['query_var']) {
if (true === $args['query_var']) {
$args['query_var'] = $this->name;
} else {
$args['query_var'] = sanitize_title_with_dashes($args['query_var']);
}
}
if (false !== $args['rewrite'] && (is_admin() || '' != get_option('permalink_structure'))) {
if (!is_array($args['rewrite'])) {
$args['rewrite'] = array();
}
if (empty($args['rewrite']['slug'])) {
$args['rewrite']['slug'] = $this->name;
}
if (!isset($args['rewrite']['with_front'])) {
$args['rewrite']['with_front'] = true;
}
if (!isset($args['rewrite']['pages'])) {
$args['rewrite']['pages'] = true;
}
if (!isset($args['rewrite']['feeds']) || !$args['has_archive']) {
$args['rewrite']['feeds'] = (bool) $args['has_archive'];
}
if (!isset($args['rewrite']['ep_mask'])) {
if (isset($args['permalink_epmask'])) {
$args['rewrite']['ep_mask'] = $args['permalink_epmask'];
} else {
$args['rewrite']['ep_mask'] = EP_PERMALINK;
}
}
}
foreach ($args as $property_name => $property_value) {
$this->{$property_name} = $property_value;
}
$this->labels = get_post_type_labels($this);
$this->label = $this->labels->name;
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:101,代码来源:class-wp-post-type.php
示例8: register
/**
* Registers the post type.
*
* If the post type already exists, some of the arguments will be merged into the existing post type object.
*
* @since 0.5.0
*/
public function register()
{
if (!$this->is_already_added()) {
$_post_type_args = $this->args;
unset($_post_type_args['title']);
unset($_post_type_args['singular_title']);
unset($_post_type_args['title_gender']);
unset($_post_type_args['messages']);
unset($_post_type_args['enter_title_here']);
unset($_post_type_args['show_add_new_in_menu']);
unset($_post_type_args['table_columns']);
unset($_post_type_args['row_actions']);
unset($_post_type_args['bulk_actions']);
unset($_post_type_args['help']);
unset($_post_type_args['list_help']);
$_post_type_args['label'] = $this->args['title'];
$_post_type_args['register_meta_box_cb'] = array($this, 'add_meta_boxes');
$post_type_args = array();
foreach ($_post_type_args as $key => $value) {
if (null !== $value) {
$post_type_args[$key] = $value;
}
}
register_post_type($this->slug, $post_type_args);
} else {
// merge several properties into existing post type
global $wp_post_types;
if (is_array($this->args['supports'])) {
foreach ($this->args['supports'] as $feature) {
add_post_type_support($this->slug, $feature);
}
}
if ($this->args['labels']) {
// merge the slug as $name into the arguments (required for `get_post_type_labels()`)
$wp_post_types[$this->slug]->labels = get_post_type_labels((object) array_merge($this->args, array('name' => $this->slug)));
$wp_post_types[$this->slug]->label = $wp_post_types[$this->slug]->labels->name;
}
add_action('add_meta_boxes_' . $this->slug, array($this, 'add_meta_boxes'), 10, 1);
}
}
开发者ID:felixarntz,项目名称:post-types-definitely,代码行数:47,代码来源:PostType.php
示例9: getLabels
/**
* {@inheritdoc}
*/
public static final function getLabels()
{
return get_post_type_labels(static::getDefinition());
}
开发者ID:asmbs,项目名称:wp-schedule-builder,代码行数:7,代码来源:AbstractPostType.php
示例10: wall_get_post_types_option
/**
* construit l'options (html) du post spécifié et ses fils
* @param object $post
* @param int $id_selected
* @param int $current_post_id : post in loop
* @param number $level
* @return string
*/
function wall_get_post_types_option($post, $id_selected = 0, $current_post_id = 0, $level = 0)
{
$res = '';
if ($id_selected == $post->ID) {
$selected = ' selected="selected"';
} else {
$selected = '';
}
$level_string = '';
for ($i = 0; $i < $level; $i++) {
$level_string .= '-';
}
$info = '';
if ($current_post_id == $post->ID) {
$post_type_label = get_post_type_labels(get_post_type_object(get_post_type($post)));
$info = ' (current ' . $post_type_label->singular_name . ')';
}
$res .= '<option data-post-type="' . get_post_type($post) . '" value="' . $post->ID . '"' . $selected . '>' . $level_string . $post->post_title . $info . '</option>';
if (is_post_type_hierarchical(get_post_type($post))) {
$children = get_post_types_by_type(get_post_type($post), array(), array('post_parent' => $post->ID));
if (!empty($children)) {
$level++;
foreach ($children as $child) {
$res .= wall_get_post_types_option($child, $id_selected, $current_post_id, $level);
}
}
}
return $res;
}
开发者ID:studio-montana,项目名称:custom,代码行数:37,代码来源:wall.php
示例11: get_displayed_post_types
$postypes = get_displayed_post_types(true);
}
global $post;
if (!empty($postypes)) {
?>
<div class="results">
<div class="column column-left">
<?php
foreach ($postypes as $postype) {
?>
<div class="post-type-selector" data-type="<?php
echo $postype;
?>
">
<?php
$post_type_label = get_post_type_labels(get_post_type_object($postype));
echo $post_type_label->name;
?>
</div>
<?php
}
?>
</div>
<div class="column column-right">
<?php
foreach ($postypes as $postype) {
$posts = get_posts(array('post_type' => $postype, "numberposts" => -1, "exclude" => $exclude));
?>
<div class="postype-section" data-type="<?php
echo $postype;
?>
开发者ID:studio-montana,项目名称:custom,代码行数:31,代码来源:postpicker-items.php
示例12: it_has_methods_for_setting_the_labels
/**
* @test
*/
function it_has_methods_for_setting_the_labels()
{
Builder::make('book')->setLabel('archives', 'All the Bookz')->setLabel('search_items', 'Find {many}')->setLabel('some_custom_label', 'BOOKMADNESS')->oneIs('Book')->manyAre('Books')->register();
$book = get_post_type_object('book');
$labels = get_post_type_labels($book);
$this->assertSame('Book', $labels->singular_name);
$this->assertSame('Books', $labels->name);
$this->assertSame('All Books', $labels->all_items);
$this->assertSame('Edit Book', $labels->edit_item);
$this->assertSame('Find Books', $labels->search_items);
$this->assertSame('BOOKMADNESS', $labels->some_custom_label);
$this->assertSame('Add New Book', $labels->add_new_item);
$this->assertSame('All the Bookz', $labels->archives);
}
开发者ID:aaemnnosttv,项目名称:silk,代码行数:17,代码来源:PostTypeBuilderTest.php
示例13: action_links
/**
* Add action links to Stream drop row in admin list screen
*
* @filter wp_stream_action_links_{connector}
*
* @param array $links Previous links registered
* @param object $record Stream record
*
* @return array Action links
*/
public static function action_links($links, $record)
{
if (in_array($record->context, array('downloads'))) {
$links = WP_Stream_Connector_Posts::action_links($links, $record);
} elseif (in_array($record->context, array('discounts'))) {
$post_type_label = get_post_type_labels(get_post_type_object('edd_discount'))->singular_name;
$base = admin_url('edit.php?post_type=download&page=edd-discounts');
$links[sprintf(__('Edit %s', 'stream'), $post_type_label)] = add_query_arg(array('edd-action' => 'edit_discount', 'discount' => $record->object_id), $base);
if ('active' === get_post($record->object_id)->post_status) {
$links[sprintf(__('Deactivate %s', 'stream'), $post_type_label)] = add_query_arg(array('edd-action' => 'deactivate_discount', 'discount' => $record->object_id), $base);
} else {
$links[sprintf(__('Activate %s', 'stream'), $post_type_label)] = add_query_arg(array('edd-action' => 'activate_discount', 'discount' => $record->object_id), $base);
}
} elseif (in_array($record->context, array('download_category', 'download_tag'))) {
$tax_label = get_taxonomy_labels(get_taxonomy($record->context))->singular_name;
$links[sprintf(__('Edit %s', 'stream'), $tax_label)] = get_edit_term_link($record->object_id, wp_stream_get_meta($record, 'taxonomy', true));
} elseif ('api_keys' === $record->context) {
$user = new WP_User($record->object_id);
if (apply_filters('edd_api_log_requests', true)) {
$links[__('View API Log', 'stream')] = add_query_arg(array('view' => 'api_requests', 'post_type' => 'download', 'page' => 'edd-reports', 'tab' => 'logs', 's' => $user->user_email), 'edit.php');
}
$links[__('Revoke', 'stream')] = add_query_arg(array('post_type' => 'download', 'user_id' => $record->object_id, 'edd_action' => 'process_api_key', 'edd_api_process' => 'revoke'), 'edit.php');
$links[__('Reissue', 'stream')] = add_query_arg(array('post_type' => 'download', 'user_id' => $record->object_id, 'edd_action' => 'process_api_key', 'edd_api_process' => 'regenerate'), 'edit.php');
}
return $links;
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:36,代码来源:class-wp-stream-connector-edd.php
示例14: extend
/**
* Extends an existing post type object. Currently only handles labels.
*
* @param stdClass|WP_Post_Type $pto A post type object
*/
public function extend($pto)
{
# Merge core with overridden labels
$this->args['labels'] = array_merge((array) get_post_type_labels($pto), $this->args['labels']);
$GLOBALS['wp_post_types'][$pto->name]->labels = (object) $this->args['labels'];
}
开发者ID:johnbillion,项目名称:extended-cpts,代码行数:11,代码来源:extended-cpts.php
示例15: custom_cmp_posttypes
/**
* Comparator for post_types string
*/
function custom_cmp_posttypes($post_type_1, $post_type_2)
{
$current_post_type_label_1 = get_post_type_labels(get_post_type_object($post_type_1));
$current_post_type_label_2 = get_post_type_labels(get_post_type_object($post_type_2));
return strcmp($current_post_type_label_1->name, $current_post_type_label_2->name);
}
开发者ID:studio-montana,项目名称:custom,代码行数:9,代码来源:comparators.php
示例16: rock_get_the_page_title
/**
* Return a page title based on the current page.
*
* @return string
*/
function rock_get_the_page_title()
{
$title = '';
switch (true) {
case is_front_page():
$title = get_the_title(get_option('page_on_front'));
break;
case is_home():
$title = get_the_title(get_option('page_for_posts'));
break;
case is_archive():
$title = get_the_archive_title();
break;
case is_search():
$title = sprintf(esc_html_x('Search Results for: %s', 'search term', 'rock'), sprintf('<span>%s</span>', get_search_query()));
break;
case is_404():
$title = esc_html__('404 Page Not Found', 'rock');
break;
case is_page():
$title = get_the_title();
break;
case ($post = get_queried_object()) && !is_post_type_hierarchical(get_post_type($post)):
$show_on_front = get_option('show_on_front');
$page_for_posts = get_option('page_for_posts');
if ('post' === $post->post_type && 'posts' !== $show_on_front && !empty($page_for_posts)) {
$title = get_the_title($page_for_posts);
break;
}
$labels = get_post_type_labels(get_post_type_object($post->post_type));
$title = isset($labels->name) ? $labels->name : false;
break;
}
/**
* Filter the page title.
*
* @since 1.0.0
*
* @var string
*/
return (string) apply_filters('rock_the_page_title', $title);
}
开发者ID:faithmade,项目名称:rock,代码行数:47,代码来源:helpers.php
注:本文中的get_post_type_labels函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论