本文整理汇总了PHP中is_object_in_taxonomy函数的典型用法代码示例。如果您正苦于以下问题:PHP is_object_in_taxonomy函数的具体用法?PHP is_object_in_taxonomy怎么用?PHP is_object_in_taxonomy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_object_in_taxonomy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: lazyLoadProperty
protected function lazyLoadProperty($key)
{
switch ($key) {
case 'page_template':
return $this->page_template = get_post_meta($this->ID, '_wp_page_template', true);
case 'post_category':
if (is_object_in_taxonomy($this->post_type, 'category')) {
$terms = get_the_terms($this->ID, 'category');
if (empty($terms)) {
$this->post_category = array();
} else {
$this->post_category = wp_list_pluck($terms, 'term_id');
}
}
return $this->post_category;
case 'tags_input':
if (is_object_in_taxonomy($this->post_type, 'post_tag')) {
$terms = get_the_terms($this->ID, 'post_tag');
if (empty($terms)) {
$this->tags_input = array();
} else {
$this->tags_input = wp_list_pluck($terms, 'name');
}
}
return $this->tags_input;
case 'ancestors':
return $this->ancestors = get_post_ancestors($this);
default:
break;
}
throw new \InvalidArgumentException("Invalid lazy-loaded property '{$key}'");
}
开发者ID:wells5609,项目名称:wp-app,代码行数:32,代码来源:Post.php
示例2: extra_tablenav
function extra_tablenav($which)
{
global $post_type_object, $cat;
?>
<div class="alignleft actions">
<?php
if ('top' == $which && !is_singular()) {
$this->months_dropdown($post_type_object->name);
if (is_object_in_taxonomy($post_type_object->name, 'category')) {
$dropdown_options = array('show_option_all' => __('View all categories'), 'hide_empty' => 0, 'hierarchical' => 1, 'show_count' => 0, 'orderby' => 'name', 'selected' => $cat);
wp_dropdown_categories($dropdown_options);
}
?>
<input type="checkbox" name="no_recipes" <?php
if (isset($_GET["no_recipes"])) {
echo "checked='checked'";
}
?>
/> Hide Posts With Recipes
<?php
do_action('restrict_manage_posts');
submit_button(__('Filter'), 'secondary', false, false, array('id' => 'post-query-submit'));
}
if ($this->is_trash && current_user_can($post_type_object->cap->edit_others_posts)) {
submit_button(__('Empty Trash'), 'button-secondary apply', 'delete_all', false);
}
?>
</div>
<?php
}
开发者ID:robotastic,项目名称:Recipe-Schema,代码行数:31,代码来源:recipe-import-post-list.php
示例3: extra_tablenav
function extra_tablenav($which)
{
global $post_type_object, $cat;
$term_id = 0;
?>
<div class="alignleft actions"> <?php
if ('top' == $which && !is_singular()) {
$this->months_dropdown(self::$post_type);
if (is_object_in_taxonomy(self::$post_type, SI_Record::TAXONOMY)) {
$term_id = isset($_GET[SI_Record::TAXONOMY]) ? $_GET[SI_Record::TAXONOMY] : 0;
$dropdown_options = array('taxonomy' => SI_Record::TAXONOMY, 'show_option_all' => __('View all types'), 'hide_empty' => 0, 'hierarchical' => 1, 'show_count' => 0, 'orderby' => 'name', 'selected' => $term_id, 'name' => SI_Record::TAXONOMY);
wp_dropdown_categories($dropdown_options);
}
do_action('restrict_manage_posts');
submit_button(__('Filter'), 'secondary', false, false, array('id' => 'post-query-submit'));
// Purge
if (count($this->items) > 0) {
if (isset($_GET[SI_Record::TAXONOMY]) && $_GET[SI_Record::TAXONOMY]) {
$term = get_term($_GET[SI_Record::TAXONOMY], SI_Record::TAXONOMY);
$button_label = __('Purge') . ' ' . $term->name . ' ' . __('Type');
}
$button_label = isset($button_label) ? $button_label : __('Purge All Types');
printf('<button type="submit" name="purge_records" class="button" value="%s">%s</button>', $term_id, $button_label);
printf('<input type="hidden" name="%s" value="%s" />', SI_Internal_Records::RECORD_PURGE_NONCE, wp_create_nonce(SI_Internal_Records::RECORD_PURGE_NONCE));
}
}
?>
</div> <?php
}
开发者ID:danielbachhuber,项目名称:marcgratch.com,代码行数:30,代码来源:Records_Admin_Table.php
示例4: sfhiv_draw_taxonomy_query_menu
function sfhiv_draw_taxonomy_query_menu($tax_name, $query, $args = array())
{
if (!is_object_in_taxonomy($query->query_vars['post_type'], $tax_name)) {
return;
}
if (!isset($args['include'])) {
$query = sfhiv_remove_url_vars_from_query($query, array($tax_name));
$query = sfhiv_unpage_query($query);
$categories = sfhiv_get_taxonomy_in($query, $tax_name, 'ids');
$args['include'] = implode(",", $categories);
if (!isset($args['min_display'])) {
$args['min_display'] = 2;
}
if (count($categories) < $args['min_display']) {
return;
}
}
if (!isset($args['base_link'])) {
if (is_page() && mini_archive_on_page(get_the_ID())) {
$args['base_link'] = get_permalink();
} else {
$args['base_link'] = get_post_type_archive_link($query->query_vars['post_type']);
}
}
if (!isset($args['title_li'])) {
$taxonomies = get_taxonomies(array('name' => $tax_name), 'objects');
foreach ($taxonomies as $taxonomy) {
$args['title_li'] = $taxonomy->label;
}
}
$args = array_merge(array('taxonomy' => $tax_name, 'show_all_link' => true), $args);
sfhiv_draw_taxonomy_menu($args);
}
开发者ID:nickdotreid,项目名称:SFHIV-Wordpress-Theme,代码行数:33,代码来源:menu_wrapper.php
示例5: twentyten_posted_in
function twentyten_posted_in()
{
// Retrieves tag list of current post, separated by commas.
$tag_list = get_the_tag_list('', ', ');
$temp_tag_array = explode(', ', $tag_list);
$buf_tag_list = array();
foreach ($temp_tag_array as $temp_tag) {
if (strpos($temp_tag, "html") > 0) {
$buf_tag_list[] = '<div class="html">' . $temp_tag . '</div>';
} elseif (strpos($temp_tag, "css") > 0) {
$buf_tag_list[] = '<div class="css">' . $temp_tag . '</div>';
} elseif (strpos($temp_tag, "jquery") > 0) {
$buf_tag_list[] = '<div class="jquery">' . $temp_tag . '</div>';
} elseif (strpos($temp_tag, "Javascript") > 0) {
$buf_tag_list[] = '<div class="Javascript">' . $temp_tag . '</div>';
} elseif (strpos($temp_tag, "wordpress") > 0) {
$buf_tag_list[] = '<div class="wordpress">' . $temp_tag . '</div>';
} else {
$buf_tag_list[] = $temp_tag;
}
}
$tag_list = implode(', ', $buf_tag_list);
if ($tag_list) {
$posted_in = __('This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten');
} elseif (is_object_in_taxonomy(get_post_type(), 'category')) {
$posted_in = __('This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten');
} else {
$posted_in = __('Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten');
}
// Prints the string, replacing the placeholders.
printf($posted_in, get_the_category_list(', '), $tag_list, get_permalink(), the_title_attribute('echo=0'));
}
开发者ID:arakawa-t,项目名称:portfolio,代码行数:32,代码来源:functions.php
示例6: iron_post_class_terms
function iron_post_class_terms($classes = array())
{
global $post, $iron_taxonomies;
/*
// Tags
if ( is_object_in_taxonomy( $post->post_type, 'post_tag' ) ) {
foreach ( (array) get_the_tags($post->ID) as $tag ) {
if ( empty($tag->slug ) )
continue;
$classes[] = 'tag-' . sanitize_html_class($tag->slug, $tag->term_id);
}
}
*/
global $post;
foreach ($iron_taxonomies as $tax) {
if (is_object_in_taxonomy($post->post_type, $tax)) {
$terms = get_the_terms($post->ID, $tax);
foreach ((array) $terms as $term) {
if (empty($term->slug)) {
continue;
}
$classes[] = sanitize_html_class($tax, 'tax') . '-' . sanitize_html_class($term->slug, $term->term_id);
}
# Alternate
// $terms = wp_list_pluck($terms, 'slug');
// $classes = array_merge($classes, $terms);
}
}
return $classes;
}
开发者ID:hathbanger,项目名称:squab,代码行数:30,代码来源:taxonomies.php
示例7: zm_base_posted_in
function zm_base_posted_in()
{
// Retrieves tag list of current post, separated by commas.
$tag_list = get_the_tag_list('', ', ');
if ($tag_list) {
$posted_in = __('<span class="zm-base-posted-in"> Posted in %1$s </span> Tags %2$s', 'collection');
} elseif (is_object_in_taxonomy(get_post_type(), 'category')) {
$posted_in = __('<span class="zm-base-posted-in"> Posted in %1$s </span> ', 'collection');
} else {
$posted_in = null;
}
// Prints the string, replacing the placeholders.
printf($posted_in, get_the_category_list(', '), $tag_list, get_the_category_list(', '));
}
开发者ID:urtow,项目名称:task-tracker,代码行数:14,代码来源:wordpress-helper-functions.php
示例8: theme_posted_in
/**
* Prints HTML with meta information for the current post (category, tags and permalink).
*
* @since Twenty Ten 1.0
*/
function theme_posted_in()
{
// Retrieves tag list of current post, separated by commas.
$tag_list = get_the_tag_list('', ', ');
if ($tag_list) {
$posted_in = __('This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'wpdance');
} elseif (is_object_in_taxonomy(get_post_type(), 'category')) {
$posted_in = __('This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'wpdance');
} else {
$posted_in = __('Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'wpdance');
}
// Prints the string, replacing the placeholders.
printf($posted_in, get_the_category_list(', '), $tag_list, get_permalink(), the_title_attribute('echo=0'));
}
开发者ID:proj-2014,项目名称:vlan247-test-wp2,代码行数:19,代码来源:posted_in_on.php
示例9: teamtheme_posted_in
/**
* Prints HTML with meta information for the current post (category, tags and permalink).
*
* @since 1.0
*/
function teamtheme_posted_in()
{
// Retrieves tag list of current post, separated by commas.
$tag_list = get_the_tag_list('', ', ');
if ($tag_list) {
$posted_in = __('This entry was posted in %1$s and tagged %2$s. ', 'twentyten');
} elseif (is_object_in_taxonomy(get_post_type(), 'category')) {
$posted_in = __('This entry was posted in %1$s.', 'twentyten');
} else {
$posted_in = __('', 'twentyten');
}
// Prints the string, replacing the placeholders.
printf($posted_in, get_the_category_list(', '), $tag_list, the_title_attribute('echo=0'));
}
开发者ID:blacksnotling,项目名称:hdwsbbl,代码行数:19,代码来源:functions.php
示例10: wp_rest_api_add_taxonomies
function wp_rest_api_add_taxonomies()
{
$post_types = get_post_types(array('public' => true), 'objects');
foreach ($post_types as $post_type) {
$show_in_rest = isset($post_type->show_in_rest) && $post_type->show_in_rest ? true : false;
if ($show_in_rest) {
$taxonomies = get_taxonomies(array(), "objects");
foreach ($taxonomies as $taxonomy) {
if (is_object_in_taxonomy($post_type->name, $taxonomy->name)) {
register_api_field($post_type->name, $taxonomy->name, array('get_callback' => array($this, 'wp_rest_api_register_taxonomy'), 'schema' => null));
}
}
}
}
}
开发者ID:kanakogi,项目名称:wp-rest-api-add-taxnomies,代码行数:15,代码来源:wp-rest-api-add-taxnomies.php
示例11: register_table_filter_query_vars
/**
* This filter registers the necessary query variables in WP_Query to detect whether we should filter by them.
*
* @since 0.6.1
* @param array $vars array of original query vars
* @return array the query vars array including the new ones
*/
public function register_table_filter_query_vars($vars)
{
$table_columns = $this->component->table_columns;
foreach ($table_columns as $column_slug => $column_args) {
if (is_array($column_args) && $column_args['filterable']) {
if (isset($column_args['taxonomy_slug']) && !empty($column_args['taxonomy_slug'])) {
if ('category' !== $column_args['taxonomy_slug'] && is_object_in_taxonomy($this->component->slug, $column_args['taxonomy_slug'])) {
$vars[] = $column_slug;
}
} elseif (isset($column_args['meta_key']) && !empty($column_args['meta_key'])) {
$vars[] = $column_slug;
}
}
}
return $vars;
}
开发者ID:felixarntz,项目名称:post-types-definitely,代码行数:23,代码来源:PostTypeQueryHandler.php
示例12: tx_folio_term
function tx_folio_term($taxonomy)
{
global $post;
$folio_categories = array();
$folio_cats = "";
$tax_seperator = "";
if (is_object_in_taxonomy($post->post_type, $taxonomy)) {
foreach ((array) wp_get_post_terms($post->ID, $taxonomy) as $term) {
if (empty($term->name)) {
continue;
}
$folio_cats .= $tax_seperator . $term->name;
$tax_seperator = ', ';
}
}
return $folio_cats;
}
开发者ID:Arkon13,项目名称:magazin2,代码行数:17,代码来源:tx-functions.php
示例13: test_register_taxonomy_for_object_type
function test_register_taxonomy_for_object_type()
{
global $wp_taxonomies;
register_post_type('bar');
register_taxonomy_for_object_type('post_tag', 'bar');
$this->assertEquals(array('post_tag'), get_object_taxonomies('bar'));
register_taxonomy_for_object_type('category', 'bar');
$this->assertEquals(array('category', 'post_tag'), get_object_taxonomies('bar'));
$this->assertTrue(is_object_in_taxonomy('bar', 'post_tag'));
$this->assertTrue(is_object_in_taxonomy('bar', 'post_tag'));
// Clean up. Remove the 'bar' post type from these taxonomies.
$GLOBALS['wp_taxonomies']['post_tag']->object_type = array('post');
$GLOBALS['wp_taxonomies']['category']->object_type = array('post');
$this->assertFalse(is_object_in_taxonomy('bar', 'post_tag'));
$this->assertFalse(is_object_in_taxonomy('bar', 'post_tag'));
_unregister_post_type('bar');
}
开发者ID:dd32,项目名称:wordpress.develop,代码行数:17,代码来源:types.php
示例14: wp_event_calendar_add_dropdown_filters
/**
* Output dropdowns & filters
*
* @since 0.1.2
*/
function wp_event_calendar_add_dropdown_filters($post_type = '')
{
// Bail if not the event post type
if ('event' !== $post_type) {
return;
}
// Bail if event type taxonomy was unregistered
if (!is_object_in_taxonomy('event', 'event-type')) {
return;
}
// Get registered taxonomies
$taxonomies = get_object_taxonomies('event', 'objects');
// Loop through query vars
foreach ($taxonomies as $taxonomy) {
// Is this taxonomy being queried?
$selected = isset($_GET[$taxonomy->query_var]) ? sanitize_key($_GET[$taxonomy->query_var]) : '';
// Output lable & dropdown
echo '<label class="screen-reader-text" for="event-type">' . sprintf(__('Filter by %s', 'wp-event-calendar'), strtolower($taxonomy->labels->singular_name)) . '</label>';
wp_dropdown_categories(array('show_option_none' => $taxonomy->labels->all_items, 'option_none_value' => 0, 'hide_empty' => true, 'hierarchical' => false, 'taxonomy' => $taxonomy->name, 'show_count' => 0, 'orderby' => 'name', 'name' => $taxonomy->query_var, 'selected' => $selected));
}
}
开发者ID:joelworsham,项目名称:wp-event-calendar,代码行数:26,代码来源:admin.php
示例15: __wcb_post_single_meta
function __wcb_post_single_meta($meta)
{
if (get_post_type() != 'post' || !is_single()) {
return $meta;
}
if (is_object_in_taxonomy(get_post_type(), 'category')) {
$meta['category'] = sprintf(__('Posted in %s', 'wordcampbase'), get_the_category_list(', '));
}
if (is_object_in_taxonomy(get_post_type(), 'tag')) {
$meta['tag'] = sprintf(__('Tagged %s', 'wordcampbase'), get_the_tag_list('', ', '));
}
$meta['order'][] = 'br';
if (isset($meta['category']) && isset($meta['tag'])) {
array_push($meta['order'], 'category', 'sep', 'tag');
} elseif (isset($meta['category'])) {
$meta['order'][] = 'category';
} elseif (isset($meta['tag'])) {
$meta['order'][] = 'tag';
} else {
array_pop($meta['order']);
}
return $meta;
}
开发者ID:serhi,项目名称:wordpress-sites,代码行数:23,代码来源:header.php
示例16: get_post_class
/**
* Retrieves the classes for the post div as an array.
*
* The class names are many. If the post is a sticky, then the 'sticky'
* class name. The class 'hentry' is always added to each post. If the post has a
* post thumbnail, 'has-post-thumbnail' is added as a class. For each taxonomy that
* the post belongs to, a class will be added of the format '{$taxonomy}-{$slug}' -
* eg 'category-foo' or 'my_custom_taxonomy-bar'.
*
* The 'post_tag' taxonomy is a special
* case; the class has the 'tag-' prefix instead of 'post_tag-'. All classes are
* passed through the filter, {@see 'post_class'}, with the list of classes, followed by
* $class parameter value, with the post ID as the last parameter.
*
* @since 2.7.0
* @since 4.2.0 Custom taxonomy classes were added.
*
* @param string|array $class One or more classes to add to the class list.
* @param int|WP_Post $post_id Optional. Post ID or post object.
* @return array Array of classes.
*/
function get_post_class($class = '', $post_id = null)
{
$post = get_post($post_id);
$classes = array();
if ($class) {
if (!is_array($class)) {
$class = preg_split('#\\s+#', $class);
}
$classes = array_map('esc_attr', $class);
} else {
// Ensure that we always coerce class to being an array.
$class = array();
}
if (!$post) {
return $classes;
}
$classes[] = 'post-' . $post->ID;
if (!is_admin()) {
$classes[] = $post->post_type;
}
$classes[] = 'type-' . $post->post_type;
$classes[] = 'status-' . $post->post_status;
// Post Format
if (post_type_supports($post->post_type, 'post-formats')) {
$post_format = get_post_format($post->ID);
if ($post_format && !is_wp_error($post_format)) {
$classes[] = 'format-' . sanitize_html_class($post_format);
} else {
$classes[] = 'format-standard';
}
}
$post_password_required = post_password_required($post->ID);
// Post requires password.
if ($post_password_required) {
$classes[] = 'post-password-required';
} elseif (!empty($post->post_password)) {
$classes[] = 'post-password-protected';
}
// Post thumbnails.
if (current_theme_supports('post-thumbnails') && has_post_thumbnail($post->ID) && !is_attachment($post) && !$post_password_required) {
$classes[] = 'has-post-thumbnail';
}
// sticky for Sticky Posts
if (is_sticky($post->ID)) {
if (is_home() && !is_paged()) {
$classes[] = 'sticky';
} elseif (is_admin()) {
$classes[] = 'status-sticky';
}
}
// hentry for hAtom compliance
$classes[] = 'hentry';
// All public taxonomies
$taxonomies = get_taxonomies(array('public' => true));
foreach ((array) $taxonomies as $taxonomy) {
if (is_object_in_taxonomy($post->post_type, $taxonomy)) {
foreach ((array) get_the_terms($post->ID, $taxonomy) as $term) {
if (empty($term->slug)) {
continue;
}
$term_class = sanitize_html_class($term->slug, $term->term_id);
if (is_numeric($term_class) || !trim($term_class, '-')) {
$term_class = $term->term_id;
}
// 'post_tag' uses the 'tag' prefix for backward compatibility.
if ('post_tag' == $taxonomy) {
$classes[] = 'tag-' . $term_class;
} else {
$classes[] = sanitize_html_class($taxonomy . '-' . $term_class, $taxonomy . '-' . $term->term_id);
}
}
}
}
$classes = array_map('esc_attr', $classes);
/**
* Filters the list of CSS classes for the current post.
*
* @since 2.7.0
*
//.........这里部分代码省略.........
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:101,代码来源:post-template.php
示例17: esc_attr
$default = '';
}
echo "<option{$default} value='" . esc_attr("{$arc_row->yyear}{$arc_row->mmonth}") . "'>";
echo $wp_locale->get_month($arc_row->mmonth) . " {$arc_row->yyear}";
echo "</option>\n";
}
?>
</select>
<?php
}
if (isset($_REQUEST["cat"]) && is_numeric($_REQUEST["cat"])) {
$cat = intval($_REQUEST["cat"]);
} else {
$cat = 0;
}
if (is_object_in_taxonomy($post_type, 'category')) {
$dropdown_options = array('show_option_all' => 'View all categories', 'hide_empty' => 0, 'hierarchical' => 1, 'show_count' => 0, 'orderby' => 'name', 'selected' => $cat);
wp_dropdown_categories($dropdown_options);
}
$posts = get_posts(array("cat" => $cat, "m" => $m, "meta_query" => $meta_query, "numberposts" => $numberposts, "offset" => $offset, "post__not_in" => $ignored_posts));
$all_posts = get_posts(array("cat" => $cat, "m" => $m, "meta_query" => $meta_query, "numberposts" => -1, "post__not_in" => $ignored_posts));
?>
<input type="submit" id="post-query-submit" value="<?php
esc_attr_e('Filter');
?>
" class="button-secondary" />
<select name="action">
<option value="none">Bulk Actions</option>
<option value="remove">Remove</option>
<option value="save">Save</option>
开发者ID:juslee,项目名称:e27,代码行数:31,代码来源:links-manager-manage.php
示例18: wp_insert_post
//.........这里部分代码省略.........
*/
do_action('pre_post_update', $post_ID, $data);
if (false === $wpdb->update($wpdb->posts, $data, $where)) {
if ($wp_error) {
return new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error);
} else {
return 0;
}
}
} else {
// If there is a suggested ID, use it if not already present.
if (!empty($import_id)) {
$import_id = (int) $import_id;
if (!$wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE ID = %d", $import_id))) {
$data['ID'] = $import_id;
}
}
if (false === $wpdb->insert($wpdb->posts, $data)) {
if ($wp_error) {
return new WP_Error('db_insert_error', __('Could not insert post into the database'), $wpdb->last_error);
} else {
return 0;
}
}
$post_ID = (int) $wpdb->insert_id;
// Use the newly generated $post_ID.
$where = array('ID' => $post_ID);
}
if (empty($data['post_name']) && !in_array($data['post_status'], array('draft', 'pending', 'auto-draft'))) {
$data['post_name'] = wp_unique_post_slug(sanitize_title($data['post_title'], $post_ID), $post_ID, $data['post_status'], $post_type, $post_parent);
$wpdb->update($wpdb->posts, array('post_name' => $data['post_name']), $where);
clean_post_cache($post_ID);
}
if (is_object_in_taxonomy($post_type, 'category')) {
wp_set_post_categories($post_ID, $post_category);
}
if (isset($postarr['tags_input']) && is_object_in_taxonomy($post_type, 'post_tag')) {
wp_set_post_tags($post_ID, $postarr['tags_input']);
}
// New-style support for all custom taxonomies.
if (!empty($postarr['tax_input'])) {
foreach ($postarr['tax_input'] as $taxonomy => $tags) {
$taxonomy_obj = get_taxonomy($taxonomy);
if (!$taxonomy_obj) {
/* translators: %s: taxonomy name */
_doing_it_wrong(__FUNCTION__, sprintf(__('Invalid taxonomy: %s.'), $taxonomy), '4.4.0');
continue;
}
// array = hierarchical, string = non-hierarchical.
if (is_array($tags)) {
$tags = array_filter($tags);
}
if (current_user_can($taxonomy_obj->cap->assign_terms)) {
wp_set_post_terms($post_ID, $tags, $taxonomy);
}
}
}
if (!empty($postarr['meta_input'])) {
foreach ($postarr['meta_input'] as $field => $value) {
update_post_meta($post_ID, $field, $value);
}
}
$current_guid = get_post_field('guid', $post_ID);
// Set GUID.
if (!$update && '' == $current_guid) {
$wpdb->update($wpdb->posts, array('guid' => get_permalink($post_ID)), $where);
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:67,代码来源:post.php
示例19: extra_tablenav
function extra_tablenav($which)
{
global $cat;
?>
<div class="alignleft actions">
<?php
if ('top' == $which && !is_singular()) {
$this->months_dropdown($this->screen->post_type);
if (is_object_in_taxonomy($this->screen->post_type, 'category')) {
$dropdown_options = array('show_option_all' => __('View all categories'), 'hide_empty' => 0, 'hierarchical' => 1, 'show_count' => 0, 'orderby' => 'name', 'selected' => $cat);
wp_dropdown_categories($dropdown_options);
}
do_action('restrict_manage_posts');
submit_button(__('Filter'), 'button', false, false, array('id' => 'post-query-submit'));
}
if ($this->is_trash && current_user_can(get_post_type_object($this->screen->post_type)->cap->edit_others_posts)) {
submit_button(__('Empty Trash'), 'apply', 'delete_all', false);
}
?>
</div>
<?php
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:22,代码来源:class-wp-posts-list-table.php
示例20: __get
/**
* Getter.
*
* @param string $key Key to get.
* @return array|mixed
*/
public function __get($key)
{
if ('page_template' == $key && $this->__isset($key)) {
return get_post_meta($this->ID, '_wp_page_template', true);
}
if ('post_category' == $key) {
if (is_object_in_taxonomy($this->post_type, 'category')) {
$terms = get_the_terms($this, 'category');
}
if (empty($terms)) {
return array();
}
return wp_list_pluck($terms, 'term_id');
}
if ('tags_input' == $key) {
if (is_object_in_taxonomy($this->post_type, 'post_tag')) {
$terms = get_the_terms($this, 'post_tag');
}
if (empty($terms)) {
return array();
}
return wp_list_pluck($terms, 'name');
}
// Rest of the values need filtering.
if ('ancestors' == $key) {
$value = get_post_ancestors($this);
} else {
$value = get_post_meta($this->ID, $key, true);
}
if ($this->filter) {
$value = sanitize_post_field($key, $value, $this->ID, $this->filter);
}
return $value;
}
开发者ID:venizeng,项目名称:pintimes-wordpress,代码行数:40,代码来源:post.php
注:本文中的is_object_in_taxonomy函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论