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


PHP wp_count_posts函数代码示例

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


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

示例1: custom_dashboard_display_stats

    function custom_dashboard_display_stats($widget)
    {
        ?>
				
				<p>Les principales valeurs statistiques de l'intégration BF QUOTES</p>
				<div class="inside">
					
						<?php 
        // global $wpdb;
        /*
        === JUST AS REMINDER
        post_type => product_for_sale
        taxonomy => product_for_sale_genre 
        taxonomy => product_for_sale_author 
        taxonomy => product_for_sale_kw 
        */
        $num_posts_bf_quotes_manager = wp_count_posts('bf_quotes_manager');
        // Main figures for product_for_sale
        $num_product_for_sale = $num_posts_product_for_sale->publish;
        // nb for Author(s)
        $num_cats_bf_quotes_manager_author = wp_count_terms('bf_quotes_manager_author');
        // nb for Flavor(s)
        $num_tags_bf_quotes_manager_flavor = wp_count_terms('bf_quotes_manager_flavor');
        ?>
				<h4><strong>Les chiffres-clés</strong></h4>
				<ul>
					<li>Nombre d' Auteur(s) : <b><?php 
        echo '' . $num_cats_bf_quotes_manager_author . '';
        ?>
</b></li>
					<li>Nombre de Saveur(s) : <b><?php 
        echo '' . $num_tags_bf_quotes_manager_flavor . '';
        ?>
</b></li>
					</ul>
				
				
				
				<h4><strong>Les dernières citations enregistrées</strong></h4>
			
				<?php 
        /* LAST POSTS */
        $args = array('offset' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'numberposts' => '3', 'post_status' => 'publish', 'post_type' => 'bf_quotes_manager');
        $recent_posts = wp_get_recent_posts($args);
        /* debug only */
        // print_r($recent_posts);
        foreach ($recent_posts as $recent) {
            setup_postdata(get_post($recent['ID']));
            // Output
            echo '<ul><li><a class="rsswidget" href="' . get_permalink($recent['ID']) . '" title="' . esc_attr(get_the_title($recent['ID'])) . '">' . get_the_title($recent['ID']) . '</a> <span class="rss-date">' . get_the_time('j F Y', $recent['ID']) . '</span><div class="rssSummary">' . $recent['post_excerpt'] . '</div></li>';
        }
        // EOL
        wp_reset_postdata();
        ?>
				
				
				</div>
					
				  <?php 
    }
开发者ID:bflaven,项目名称:PluginWordpressForFun,代码行数:60,代码来源:bf_quotes_manager_admin.php

示例2: __construct

 /**
  * Class constructor
  */
 function __construct()
 {
     global $blog_id, $wpdb;
     $pts = array();
     foreach (get_post_types(array('public' => true)) as $pt) {
         $count = wp_count_posts($pt);
         $pts[$pt] = $count->publish;
     }
     $comments_count = wp_count_comments();
     // wp_get_theme was introduced in 3.4, for compatibility with older versions, let's do a workaround for now.
     if (function_exists('wp_get_theme')) {
         $theme_data = wp_get_theme();
         $theme = array('name' => $theme_data->display('Name', false, false), 'theme_uri' => $theme_data->display('ThemeURI', false, false), 'version' => $theme_data->display('Version', false, false), 'author' => $theme_data->display('Author', false, false), 'author_uri' => $theme_data->display('AuthorURI', false, false));
     } else {
         $theme_data = (object) get_theme_data(get_stylesheet_directory() . '/style.css');
         $theme = array('version' => $theme_data->Version, 'name' => $theme_data->Name, 'author' => $theme_data->Author, 'template' => $theme_data->Template);
     }
     $plugins = array();
     foreach (get_option('active_plugins') as $plugin_path) {
         if (!function_exists('get_plugin_data')) {
             require_once ABSPATH . 'wp-admin/includes/admin.php';
         }
         $plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path);
         $slug = str_replace('/' . basename($plugin_path), '', $plugin_path);
         $plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']);
     }
     $data = array('site' => array('hash' => site_url(), 'version' => get_bloginfo('version'), 'multisite' => is_multisite(), 'users' => $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->users} INNER JOIN {$wpdb->usermeta} ON ({$wpdb->users}.ID = {$wpdb->usermeta}.user_id) WHERE 1 = 1 AND ( {$wpdb->usermeta}.meta_key = %s )", 'wp_' . $blog_id . '_capabilities')), 'lang' => get_locale()), 'theme' => $theme, 'plugins' => $plugins, 'email' => get_option('admin_email'), 'param' => 'class_tracking', 'action' => 'license_validator');
     $url = get_option("gallery-bank-updation-check-url");
     $response = wp_remote_post($url, array('method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => $data));
 }
开发者ID:shellygraham,项目名称:livestock-framing,代码行数:33,代码来源:class-tracking.php

示例3: callback

 public function callback($path = '', $blog_id = 0, $post_type = 'post')
 {
     if (!get_current_user_id()) {
         return new WP_Error('authorization_required', __('An active access token must be used to retrieve post counts.', 'jetpack'), 403);
     }
     $blog_id = $this->api->switch_to_blog_and_validate_user($this->api->get_blog_id($blog_id), false);
     if (is_wp_error($blog_id)) {
         // invalid token/user access
         return $blog_id;
     }
     if (!post_type_exists($post_type)) {
         return new WP_Error('unknown_post_type', __('Unknown post type requested.', 'jetpack'), 404);
     }
     $wp_post_counts = (array) wp_count_posts($post_type);
     $whitelist = array('publish');
     $counts = array();
     if (current_user_can('edit_posts')) {
         array_push($whitelist, 'draft', 'future', 'pending', 'private', 'trash');
     }
     foreach ($wp_post_counts as $post_type => $type_count) {
         if (in_array($post_type, $whitelist)) {
             $counts[$post_type] = (int) $type_count;
         }
     }
     $return = array('statuses' => (array) $counts);
     return $return;
 }
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:27,代码来源:class.wpcom-json-api-get-post-counts-v1-1-endpoint.php

示例4: status_menu

 public function status_menu($post_stati)
 {
     global $parent_file, $submenu, $submenu_file;
     $num_posts = wp_count_posts('page', 'readable');
     $num_total = array_sum((array) $num_posts);
     $link = $submenu_file = 'edit-pages.php';
     $submenu[$parent_file] = array(array(__('Add New Page'), 'edit_pages', 'page-new.php'), array(sprintf(__('All (%s)', 'ktai_style'), $num_total), 'edit_pages', $link));
     $post_status_label = __('Pages');
     $avail_post_stati = get_available_post_statuses('page');
     foreach ($post_stati as $status => $label) {
         if (!in_array($status, $avail_post_stati)) {
             continue;
         }
         if (empty($num_posts->{$status})) {
             continue;
         }
         $link = add_query_arg('post_status', $status, $link);
         $submenu[$parent_file][] = array(sprintf(__ngettext($label[2][0], $label[2][1], $num_posts->{$status}, 'ktai_style'), number_format_i18n($num_posts->{$status})), 'edit_pages', $link);
         if (str_replace('all', '', $status) == $_GET['post_status']) {
             $submenu_file = $link;
             $post_status_label = $label[1];
             $num_total = $num_posts->{$status};
         }
     }
     return array($post_status_label, $num_total);
 }
开发者ID:masayukiando,项目名称:wordpress-event-search,代码行数:26,代码来源:edit-pages.php

示例5: presstrends

function presstrends()
{
    // Add your PressTrends and Theme API Keys
    $api_key = 'fwaauw8aofwq21vgs1mw8b8g87q9x0rrezv4';
    $auth = 'kzsc8b4g65i3j88rsu3oix8dkmufi5gbp';
    // NO NEED TO EDIT BELOW
    $data = get_transient('presstrends_data');
    if (!$data || $data == '') {
        $api_base = 'http://api.presstrends.io/index.php/api/sites/add/auth/';
        $url = $api_base . $auth . '/api/' . $api_key . '/';
        $data = array();
        $count_posts = wp_count_posts();
        $comments_count = wp_count_comments();
        $theme_data = get_theme_data(get_template_directory() . '/style.css');
        $plugin_count = count(get_option('active_plugins'));
        $data['url'] = stripslashes(str_replace(array('http://', '/', ':'), '', site_url()));
        $data['posts'] = $count_posts->publish;
        $data['comments'] = $comments_count->total_comments;
        $data['theme_version'] = $theme_data['Version'];
        $data['theme_name'] = str_replace(' ', '', get_bloginfo('name'));
        $data['plugins'] = $plugin_count;
        $data['wpversion'] = get_bloginfo('version');
        foreach ($data as $k => $v) {
            $url .= $k . '/' . $v . '/';
        }
        $response = wp_remote_get($url);
        set_transient('presstrends_data', $data, 60 * 60 * 24);
    }
}
开发者ID:aguerojahannes,项目名称:aguerojahannes.com,代码行数:29,代码来源:functions.php

示例6: test

 public function test($views)
 {
     global $wp_query;
     print_r(wp_count_posts('ticket'));
     //		print_r( $wp_query );
     return $views;
 }
开发者ID:vasikgreif,项目名称:Awesome-Support,代码行数:7,代码来源:class-admin-tickets-list.php

示例7: status_widget

    public function status_widget()
    {
        $counts = wp_count_posts('pronamic_payment');
        $states = array('payment_completed' => __('%s completed', 'pronamic_ideal'), 'payment_pending' => __('%s pending', 'pronamic_ideal'), 'payment_cancelled' => __('%s cancelled', 'pronamic_ideal'), 'payment_failed' => __('%s failed', 'pronamic_ideal'), 'payment_expired' => __('%s expired', 'pronamic_ideal'));
        $url = add_query_arg(array('post_type' => 'pronamic_payment'), admin_url('edit.php'));
        ?>
		<ul class="pronamic-pay-status-list">

			<?php 
        foreach ($states as $status => $label) {
            ?>

				<li class="<?php 
            echo esc_attr('payment_status-' . $status);
            ?>
">
					<a href="<?php 
            echo esc_attr(add_query_arg('post_status', $status, $url));
            ?>
">
						<?php 
            $count = isset($counts->{$status}) ? $counts->{$status} : 0;
            printf($label, '<strong>' . sprintf(esc_html(_n('%s payment', '%s payments', $count, 'pronamic_ideal')), esc_html(number_format_i18n($count))) . '</strong>');
            ?>
					</a>
				</li>

			<?php 
        }
        ?>

		</ul>
		<?php 
    }
开发者ID:Charitable,项目名称:wp-pronamic-ideal,代码行数:34,代码来源:Dashboard.php

示例8: scoper_right_now_pending

function scoper_right_now_pending()
{
    $post_types = array_diff_key(get_post_types(array('public' => true), 'object'), array('attachment' => true));
    foreach ($post_types as $post_type => $post_type_obj) {
        if ($num_posts = wp_count_posts($post_type)) {
            if (!empty($num_posts->pending)) {
                echo "\n\t" . '<tr>';
                $num = number_format_i18n($num_posts->pending);
                //$text = _n( 'Pending Page', 'Pending Pages', intval($num_pages->pending), 'scoper' );
                if (intval($num_posts->pending) <= 1) {
                    $text = sprintf(__('Pending %1$s', 'scoper'), $post_type_obj->labels->singular_name);
                } else {
                    $text = sprintf(__('Pending %1$s', 'scoper'), $post_type_obj->labels->name);
                }
                $type_clause = 'post' == $post_type ? '' : "&post_type={$post_type}";
                $url = "edit.php?post_status=pending{$type_clause}";
                $num = "<a href='{$url}'><span class='pending-count'>{$num}</span></a>";
                $text = "<a class='waiting' href='{$url}'>{$text}</a>";
                $type_class = $post_type_obj->hierarchical ? 'b-pages' : 'b-posts';
                echo '<td class="first b ' . $type_class . ' b-waiting">' . $num . '</td>';
                echo '<td class="t posts">' . $text . '</td>';
                echo '<td class="b"></td>';
                echo '<td class="last t"></td>';
                echo "</tr>\n\t";
            }
        }
    }
}
开发者ID:joostrijneveld,项目名称:cscircles-wp-content,代码行数:28,代码来源:admin-dashboard_rs.php

示例9: column_usage

 function column_usage($item)
 {
     global $wpdb;
     $total = wp_count_posts('property');
     $used = $wpdb->get_var("SELECT COUNT(DISTINCT(post_id)) FROM {$wpdb->postmeta} WHERE meta_key = '" . $item['key'] . "' ");
     return $used . '/' . $total->publish;
 }
开发者ID:SchaeferZone,项目名称:wp-estatement,代码行数:7,代码来源:EST_Customdata_Table.class.php

示例10: register_taxonomy

    register_taxonomy('question_tag', array('question'), $taxonomy_question_tag_args);
    /**
	 * Register a taxonomy for Question Categories
	 * http://codex.wordpress.org/Function_Reference/register_taxonomy
	 */
    $taxonomy_question_category_labels = array('name' => _x('Idea Categories', 'questionposttype'), 'singular_name' => _x('Idea Category', 'questionposttype'), 'search_items' => _x('Search Idea Categories', 'questionposttype'), 'popular_items' => _x('Popular Idea Categories', 'questionposttype'), 'all_items' => _x('All Idea Categories', 'questionposttype'), 'parent_item' => _x('Parent Idea Category', 'questionposttype'), 'parent_item_colon' => _x('Parent Idea Category:', 'questionposttype'), 'edit_item' => _x('Edit Idea Category', 'questionposttype'), 'update_item' => _x('Update Idea Category', 'questionposttype'), 'add_new_item' => _x('Add New Idea Category', 'questionposttype'), 'new_item_name' => _x('New Idea Category Name', 'questionposttype'), 'separate_items_with_commas' => _x('Separate idea categories with commas', 'questionposttype'), 'add_or_remove_items' => _x('Add or remove idea categories', 'questionposttype'), 'choose_from_most_used' => _x('Choose from the most used idea categories', 'questionposttype'), 'menu_name' => _x('Idea Categories', 'questionposttype'));
    $taxonomy_question_category_args = array('labels' => $taxonomy_question_category_labels, 'public' => true, 'show_in_nav_menus' => true, 'show_ui' => true, 'show_tagcloud' => true, 'hierarchical' => true, 'rewrite' => array('slug' => 'ideas'), 'query_var' => true);
    register_taxonomy('question_category', array('question'), $taxonomy_question_category_args);
}
add_action('init', 'questionposttype', 0);
// Allow thumbnails to be used on portfolio post type
add_theme_support('post-thumbnails', array('question'));
/**
 * Add Question count to "Right Now" Dashboard Widget
 */
function add_question_counts()
{
    if (!post_type_exists('question')) {
        return;
    }
    $num_posts = wp_count_posts('question');
    $num = number_format_i18n($num_posts->publish);
    $text = _n('Idea Item', 'Idea Items', intval($num_posts->publish));
    if (current_user_can('edit_posts')) {
        $num = "<a href='edit.php?post_type=question'>{$num}</a>";
        $text = "<a href='edit.php?post_type=question'>{$text}</a>";
    }
    echo '<td class="first b b-question">' . $num . '</td>';
开发者ID:gp6shc,项目名称:aok,代码行数:28,代码来源:question-post-type.php

示例11: edd_show_upgrade_notices

/**
 * Display Upgrade Notices
 *
 * @since 1.3.1
 * @return void
*/
function edd_show_upgrade_notices()
{
    if (isset($_GET['page']) && $_GET['page'] == 'edd-upgrades') {
        return;
    }
    // Don't show notices on the upgrades page
    $edd_version = get_option('edd_version');
    if (!$edd_version) {
        // 1.3 is the first version to use this option so we must add it
        $edd_version = '1.3';
    }
    if (!get_option('edd_payment_totals_upgraded') && !get_option('edd_version')) {
        if (wp_count_posts('edd_payment')->publish < 1) {
            return;
        }
        // No payment exist yet
        // The payment history needs updated for version 1.2
        $url = add_query_arg('edd-action', 'upgrade_payments');
        $upgrade_notice = sprintf(__('The Payment History needs to be updated. %s', 'edd'), '<a href="' . wp_nonce_url($url, 'edd_upgrade_payments_nonce') . '">' . __('Click to Upgrade', 'edd') . '</a>');
        add_settings_error('edd-notices', 'edd-payments-upgrade', $upgrade_notice, 'error');
    }
    if (version_compare($edd_version, '1.3.2', '<') && !get_option('edd_logs_upgraded')) {
        printf('<div class="updated"><p>' . esc_html__('The Purchase and File Download History in Easy Digital Downloads needs to be upgraded, click %shere%s to start the upgrade.', 'edd') . '</p></div>', '<a href="' . esc_url(admin_url('options.php?page=edd-upgrades')) . '">', '</a>');
    }
    if (version_compare($edd_version, '1.3.4', '<') || version_compare($edd_version, '1.4', '<')) {
        printf('<div class="updated"><p>' . esc_html__('Easy Digital Downloads needs to upgrade the plugin pages, click %shere%s to start the upgrade.', 'edd') . '</p></div>', '<a href="' . esc_url(admin_url('options.php?page=edd-upgrades')) . '">', '</a>');
    }
    if (version_compare($edd_version, '1.5', '<')) {
        printf('<div class="updated"><p>' . esc_html__('Easy Digital Downloads needs to upgrade the database, click %shere%s to start the upgrade.', 'edd') . '</p></div>', '<a href="' . esc_url(admin_url('options.php?page=edd-upgrades')) . '">', '</a>');
    }
}
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:37,代码来源:upgrade-functions.php

示例12: send_test_mail

 /**
  * Send a test mail from option panel
  *
  * @since   1.0.0
  * @return  void
  * @author  Alberto Ruggiero
  */
 public function send_test_mail()
 {
     ob_start();
     $total_products = wp_count_posts('product');
     if (!$total_products->publish) {
         wp_send_json(array('error' => __('In order to send the test email, at least one product has to be published', 'yith-woocommerce-review-reminder')));
     } else {
         $args = array('posts_per_page' => 2, 'orderby' => 'rand', 'post_type' => 'product');
         $random_products = get_posts($args);
         $test_items = array();
         foreach ($random_products as $item) {
             $test_items[$item->ID]['id'] = $item->ID;
             $test_items[$item->ID]['name'] = $item->post_title;
         }
         $days = get_option('ywrr_mail_schedule_day');
         $test_email = $_POST['email'];
         $template = $_POST['template'];
         try {
             $wc_email = WC_Emails::instance();
             $email = $wc_email->emails['YWRR_Request_Mail'];
             $email_result = $email->trigger(0, $test_items, $days, $test_email, $template);
             if (!$email_result) {
                 wp_send_json(array('error' => __('There was an error while sending the email', 'yith-woocommerce-review-reminder')));
             } else {
                 wp_send_json(true);
             }
         } catch (Exception $e) {
             wp_send_json(array('error' => $e->getMessage()));
         }
     }
 }
开发者ID:VitaliyProdan,项目名称:wp_shop,代码行数:38,代码来源:class-ywrr-ajax.php

示例13: widget_content

 /**
  * Generate the content of the widget.
  *
  * @param	array	args		The array of form elements
  * @param	array	instance	The current instance of the widget
  */
 public function widget_content($args, $instance)
 {
     extract($args, EXTR_SKIP);
     extract($instance);
     $count = (array) wp_count_posts('movie');
     $count = array('movies' => $count['publish'], 'imported' => $count['import-draft'], 'queued' => $count['import-queued'], 'draft' => $count['draft'], 'total' => 0);
     $count['total'] = array_sum($count);
     $count['collections'] = wp_count_terms('collection');
     $count['genres'] = wp_count_terms('genre');
     $count['actors'] = wp_count_terms('actor');
     $count = array_map('intval', $count);
     extract($count);
     $links = array();
     $links['%total%'] = sprintf('<a href="%s">%s</a>', get_post_type_archive_link('movie'), sprintf(_n('<strong>1</strong> movie', '<strong>%d</strong> movies', $movies, 'wpmovielibrary'), $movies));
     $links['%collections%'] = WPMOLY_Utils::get_taxonomy_permalink('collection', sprintf(_n('<strong>1</strong> collection', '<strong>%d</strong> collections', $collections, 'wpmovielibrary'), $collections));
     $links['%genres%'] = WPMOLY_Utils::get_taxonomy_permalink('genre', sprintf(_n('<strong>1</strong> genre', '<strong>%d</strong> genres', $genres, 'wpmovielibrary'), $genres));
     $links['%actors%'] = WPMOLY_Utils::get_taxonomy_permalink('actor', sprintf(_n('<strong>1</strong> actor', '<strong>%d</strong> actors', $actors, 'wpmovielibrary'), $actors));
     $title = $before_title . apply_filters('widget_title', $title) . $after_title;
     $description = esc_attr($description);
     $format = wpautop(wp_kses($format, array('ul', 'ol', 'li', 'p', 'span', 'em', 'i', 'p', 'strong', 'b', 'br')));
     $content = str_replace(array_keys($links), array_values($links), $format);
     $style = 'wpmoly-widget wpmoly-statistics';
     $attributes = array('content' => $content, 'description' => $description, 'style' => $style);
     $html = WPMovieLibrary::render_template('statistics-widget/statistics.php', $attributes, $require = 'always');
     return $before_widget . $title . $html . $after_widget;
 }
开发者ID:masterdoed,项目名称:wpmovielibrary,代码行数:32,代码来源:class-statistics-widget.php

示例14: widget

 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     if ($title) {
         $title = $before_title . $title . $after_title;
     }
     $count_posts = wp_count_posts('post');
     $published_posts = $count_posts->publish;
     $count_posts = wp_count_posts('link');
     $published_links = $count_posts->publish;
     $count_posts = wp_count_posts('snippet');
     $published_snippets = $count_posts->publish;
     $feeds = '';
     $feeds .= '<li><i class="fa fa-rss"></i> <a href="' . site_url() . '/feed/">Subscribe to All</a></li>';
     if ($published_posts) {
         $feeds .= '<li><i class="fa fa-rss"></i> <a href="' . site_url() . '/feed/?post_type=post">Subscribe to Posts</a></li>';
     }
     if ($published_links) {
         $feeds .= '<li><i class="fa fa-rss"></i> <a href="' . site_url() . '/feed/?post_type=link">Subscribe to Links</a></li>';
     }
     if ($published_snippets) {
         $feeds .= '<li><i class="fa fa-rss"></i> <a href="' . site_url() . '/feed/?post_type=snippet">Subscribe to Snippets</a></li>';
     }
     if ($feeds != '') {
         echo $before_widget;
         echo $title;
         echo '<ul class="subscriptions">';
         echo $feeds;
         echo '</ul>';
         echo $after_widget;
     }
 }
开发者ID:corenominal,项目名称:corenominal-wp-custom-post-types,代码行数:33,代码来源:subscriptions.php

示例15: pending_posts_indicator

/**
 * Show the number of pending posts waiting for approval in the admin menu, if any
 * @param array $menu 
 * @return array
 */
function pending_posts_indicator($menu)
{
    $post_types = get_post_types();
    if (empty($post_types)) {
        return;
    }
    foreach ($post_types as $type) {
        $status = 'pending';
        $num_posts = wp_count_posts($type, 'readable');
        $pending_count = 0;
        if (!empty($num_posts->{$status})) {
            $pending_count = $num_posts->{$status};
        }
        // Build string to match in $menu array
        if ($type == 'post') {
            $menu_str = 'edit.php';
        } else {
            $menu_str = 'edit.php?post_type=' . $type;
        }
        // Loop through $menu items, find match, add indicator
        foreach ($menu as $menu_key => $menu_data) {
            if ($menu_str != $menu_data[2]) {
                continue;
            } else {
                // NOTE: Using the same CSS classes as the plugin updates count, it will match your admin color theme just fine.
                $menu[$menu_key][0] .= " <span class='update-plugins count-{$pending_count}'><span class='plugin-count'>" . number_format_i18n($pending_count) . '</span></span>';
            }
        }
    }
    return $menu;
}
开发者ID:radekzz,项目名称:pending-post-inidicator-and-notifier,代码行数:36,代码来源:pending-post-inidicator-and-notifier.php


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