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

PHP wp_count_terms函数代码示例

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

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



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

 /**
  * Display a javascript collection for autocompletion script !
  *
  * @return void
  * @author Amaury Balmer
  */
 public static function ajax_local_tags()
 {
     status_header(200);
     // Send good header HTTP
     header("Content-Type: application/json; charset=" . get_bloginfo('charset'));
     $taxonomy = 'post_tag';
     if (isset($_REQUEST['taxonomy']) && taxonomy_exists($_REQUEST['taxonomy'])) {
         $taxonomy = $_REQUEST['taxonomy'];
     }
     if ((int) wp_count_terms($taxonomy, 'ignore_empty=false') == 0) {
         // No tags to suggest
         json_encode(array());
         exit;
     }
     // Prepare search
     $search = isset($_GET['term']) ? trim(stripslashes($_GET['term'])) : '';
     // Get all terms, or filter with search
     $terms = SimpleTags_Admin::getTermsForAjax($taxonomy, $search);
     if (empty($terms) || $terms == false) {
         json_encode(array());
         exit;
     }
     // Format terms
     $results = array();
     foreach ((array) $terms as $term) {
         $term->name = stripslashes($term->name);
         $term->name = str_replace(array("\r\n", "\r", "\n"), '', $term->name);
         $results[] = array('id' => $term->term_id, 'label' => $term->name, 'value' => $term->name);
     }
     echo json_encode($results);
     exit;
 }
开发者ID:rongandat,项目名称:best-picture,代码行数:38,代码来源:class.admin.autocomplete.php


示例3: show_tag_filter

 /**
  * Show the tag cloud
  */
 public function show_tag_filter($shortcode_atts)
 {
     if (isset($shortcode_atts['show_tags']) && ($shortcode_atts['show_tags'] === false || (string) $shortcode_atts['show_tags'] == 'false')) {
         return;
     }
     if (wp_count_terms('job_listing_tag') == 0) {
         return;
     }
     wp_register_script('wp-job-manager-ajax-tag-filters', JOB_MANAGER_TAGS_PLUGIN_URL . '/assets/js/tag-filter.js', array('jquery'), '1.0', true);
     $args_data = array('orderby' => 'count', 'order' => 'DESC');
     $jobs_tags_data = get_terms('job_listing_tag', $args_data);
     $queried_object = get_queried_object();
     foreach ($jobs_tags_data as $key => $jobs_tag_data) {
         if ($jobs_tag_data->count > 1) {
             $jobs_txt = 'jobs';
             $font_size = 2;
         } else {
             $jobs_txt = 'job';
             $font_size = 1;
         }
         //if($queried_object->term_id == $jobs_tag_data->term_id){ $active_class = 'activee'; }
         $anchor_data[] = '<a href="#" id="test_' . $key . '" "class="tag-link-' . $jobs_tag_data->term_id . ' ' . $active_class . ' show_bg_tag" title="' . $jobs_tag_data->count . ' ' . $jobs_txt . '" style="font-size: ' . $font_size . 'em;">' . $jobs_tag_data->name . '</a>';
     }
     $anchor_tag_data = array('anchor_tag_data' => $anchor_data);
     //anchor_tag_data
     wp_localize_script('wp-job-manager-ajax-tag-filters', 'anchor_tag_data_object', $anchor_tag_data);
     wp_enqueue_script('wp-job-manager-ajax-tag-filters', JOB_MANAGER_TAGS_PLUGIN_URL . '/assets/js/tag-filter.js', array('jquery'), '1.0', true);
     echo '<div class="filter_wide filter_by_tag">' . __('Filter by tag:', 'wp-job-manager-tags') . ' <span class="filter_by_tag_cloud"></span></div>';
 }
开发者ID:vinodhip,项目名称:Function-22-Website,代码行数:32,代码来源:class-job-manager-job-tags-shortcodes.php


示例4: 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


示例5: prepare_items

	function prepare_items() {
		global $taxonomy;

		$tags_per_page = $this->get_items_per_page( 'edit_' .  $taxonomy . '_per_page' );

		if ( 'post_tag' == $taxonomy ) {
			$tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
			$tags_per_page = apply_filters( 'tagsperpage', $tags_per_page ); // Old filter
		} elseif ( 'category' == $taxonomy ) {
			$tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); // Old filter
		}

		$search = !empty( $_REQUEST['s'] ) ? trim( stripslashes( $_REQUEST['s'] ) ) : '';

		$args = array(
			'search' => $search,
			'page' => $this->get_pagenum(),
			'number' => $tags_per_page,
		);

		if ( !empty( $_REQUEST['orderby'] ) )
			$args['orderby'] = trim( stripslashes( $_REQUEST['orderby'] ) );

		if ( !empty( $_REQUEST['order'] ) )
			$args['order'] = trim( stripslashes( $_REQUEST['order'] ) );

		$this->callback_args = $args;

		$this->set_pagination_args( array(
			'total_items' => wp_count_terms( $taxonomy, compact( 'search' ) ),
			'per_page' => $tags_per_page,
		) );
	}
开发者ID:realfluid,项目名称:umbaugh,代码行数:33,代码来源:class-wp-terms-list-table.php


示例6: ajaxLocalTags

 /**
  * Display a javascript collection for autocompletion script !
  *
  * @return void
  * @author Amaury Balmer
  */
 function ajaxLocalTags()
 {
     status_header(200);
     // Send good header HTTP
     header("Content-Type: text/plain; charset=" . get_bloginfo('charset'));
     $taxonomy = 'post_tag';
     if (isset($_REQUEST['taxonomy']) && taxonomy_exists($_REQUEST['taxonomy'])) {
         $taxonomy = $_REQUEST['taxonomy'];
     }
     if ((int) wp_count_terms($taxonomy, 'ignore_empty=false') == 0) {
         // No tags to suggest
         exit;
     }
     // Prepare search
     $search = isset($_GET['q']) ? trim(stripslashes($_GET['q'])) : '';
     // Get all terms, or filter with search
     $terms = $this->getTermsForAjax($taxonomy, $search);
     if (empty($terms) || $terms == false) {
         exit;
     }
     // Format terms
     foreach ((array) $terms as $term) {
         $term->name = stripslashes($term->name);
         $term->name = str_replace(array("\r\n", "\r", "\n"), '', $term->name);
         echo "{$term->term_id}|{$term->name}\n";
     }
     exit;
 }
开发者ID:rubyerme,项目名称:rubyerme.github.com,代码行数:34,代码来源:class.admin.autocomplete.php


示例7: wpmp_msma_overview

function wpmp_msma_overview($menu)
{
    $base = get_option('home');
    $post_count = wp_count_posts('post');
    $page_count = wp_count_posts('page');
    print "<p>";
    printf(__ngettext("You have one post", "You have %d posts", $c = 0 + $post_count->publish, 'wpmp'), $c);
    print ' ';
    printf(__ngettext("and one page", "and %d pages", $c = 0 + $page_count->publish, 'wpmp'), $c);
    print ' ' . __("contained within", 'wpmp') . ' ';
    printf(__ngettext("one category", "%d categories", $c = 0 + wp_count_terms('category'), 'wpmp'), $c);
    print ' ' . __("and", 'wpmp') . ' ';
    printf(__ngettext("one tag", "%d tags", $c = 0 + wp_count_terms('post_tag'), 'wpmp'), $c);
    print ".</p>";
    global $wpdb;
    $comments = $wpdb->get_results("SELECT count(*) as cnt FROM {$wpdb->comments} WHERE comment_approved='0'");
    $comment_count = $comments[0];
    printf("<p>" . __ngettext("You have one comment to moderate", "You have %d comments to moderate", $c = 0 + $comment_count->cnt, 'wpmp') . ".</p>", $c);
    print "<h3>" . __("Select an admin page:", 'wpmp') . "</h3>";
    print "<p><ul>";
    $not_first = false;
    foreach ($menu as $name => $link) {
        if ($name[0] != '_' && $not_first) {
            if (substr($link, 0, 7) != "http://" && substr($link, 0, 8) != "https://") {
                $link = $base . $link;
            }
            print "<li><a href='{$link}'>" . __("{$name}", 'wpmp') . "</a>";
        }
        $not_first = true;
    }
    print "</ul></p>";
    print "<p>" . sprintf(__("...or <a%s>return to the site</a>", 'wpmp'), " href='{$base}/'") . "</p>";
    print "<p>" . __("A subset of the full WordPress administration is available through this mobile interface.", 'wpmp') . "</p>";
}
开发者ID:nil-vn,项目名称:beautysite,代码行数:34,代码来源:mobile_admin.php


示例8: test_wp_insert_delete_term

 public function test_wp_insert_delete_term()
 {
     $taxonomy = 'wptests_tax';
     register_taxonomy($taxonomy, 'post');
     // a new unused term
     $term = rand_str();
     $this->assertNull(term_exists($term));
     $initial_count = wp_count_terms($taxonomy);
     $t = wp_insert_term($term, $taxonomy);
     $this->assertInternalType('array', $t);
     $this->assertNotWPError($t);
     $this->assertTrue($t['term_id'] > 0);
     $this->assertTrue($t['term_taxonomy_id'] > 0);
     $this->assertEquals($initial_count + 1, wp_count_terms($taxonomy));
     // make sure the term exists
     $this->assertTrue(term_exists($term) > 0);
     $this->assertTrue(term_exists($t['term_id']) > 0);
     // now delete it
     add_filter('delete_term', array($this, 'deleted_term_cb'), 10, 5);
     $this->assertTrue(wp_delete_term($t['term_id'], $taxonomy));
     remove_filter('delete_term', array($this, 'deleted_term_cb'), 10, 5);
     $this->assertNull(term_exists($term));
     $this->assertNull(term_exists($t['term_id']));
     $this->assertEquals($initial_count, wp_count_terms($taxonomy));
 }
开发者ID:dd32,项目名称:wordpress.develop,代码行数:25,代码来源:wpInsertTerm.php


示例9: seventeen_right_now_content_table_end

/**
 * Add Custom Post Types and Taxonomies to "At a Glance" Dashboard Widget
 *
 * Ref Link: http://wpsnipp.com/index.php/functions-php/include-custom-post-types-in-right-now-admin-dashboard-widget/
 * http://wordpress.org/support/topic/dashboard-at-a-glance-custom-post-types
 * http://halfelf.org/2012/my-custom-posttypes-live-in-mu/
 */
function seventeen_right_now_content_table_end()
{
    $args = array('public' => true, '_builtin' => false);
    $output = 'object';
    $operator = 'and';
    $post_types = get_post_types($args, $output, $operator);
    foreach ($post_types as $post_type) {
        $num_posts = wp_count_posts($post_type->name);
        $num = number_format_i18n($num_posts->publish);
        $text = _n($post_type->labels->name, $post_type->labels->name, intval($num_posts->publish));
        if (current_user_can('edit_posts')) {
            $cpt_name = $post_type->name;
        }
        echo '<li class="post-count ' . $post_type->name . '-count"><tr><a href="edit.php?post_type=' . $cpt_name . '"><td class="first b b-' . $post_type->name . '"></td>' . $num . '&nbsp;<td class="t ' . $post_type->name . '">' . $text . '</td></a></tr></li>';
    }
    $taxonomies = get_taxonomies($args, $output, $operator);
    foreach ($taxonomies as $taxonomy) {
        $num_terms = wp_count_terms($taxonomy->name);
        $num = number_format_i18n($num_terms);
        $text = _n($taxonomy->labels->name, $taxonomy->labels->name, intval($num_terms));
        if (current_user_can('manage_categories')) {
            $cpt_tax = $taxonomy->name;
        }
        echo '<li class="taxonomy-count ' . $taxonomy->name . '-count"><tr><a href="edit-tags.php?taxonomy=' . $cpt_tax . '"><td class="first b b-' . $taxonomy->name . '"></td>' . $num . '&nbsp;<td class="t ' . $taxonomy->name . '">' . $text . '</td></a></tr></li>';
    }
}
开发者ID:psflannery,项目名称:seventeen,代码行数:33,代码来源:admin.php


示例10: wph_right_now_content_table_end

function wph_right_now_content_table_end()
{
    $args = array('public' => true, '_builtin' => false);
    $output = 'object';
    $operator = 'and';
    $post_types = get_post_types($args, $output, $operator);
    foreach ($post_types as $post_type) {
        $num_posts = wp_count_posts($post_type->name);
        $num = number_format_i18n($num_posts->publish);
        $text = _n($post_type->labels->singular_name, $post_type->labels->name, intval($num_posts->publish));
        if (current_user_can('edit_posts')) {
            $num = "<a href='edit.php?post_type={$post_type->name}'>{$num}</a>";
            $text = "<a href='edit.php?post_type={$post_type->name}'>{$text}</a>";
        }
        echo '<tr><td class="first num b b-' . $post_type->name . '">' . $num . '</td>';
        echo '<td class="text t ' . $post_type->name . '">' . $text . '</td></tr>';
    }
    $taxonomies = get_taxonomies($args, $output, $operator);
    foreach ($taxonomies as $taxonomy) {
        $num_terms = wp_count_terms($taxonomy->name);
        $num = number_format_i18n($num_terms);
        $text = _n($taxonomy->labels->singular_name, $taxonomy->labels->name, intval($num_terms));
        if (current_user_can('manage_categories')) {
            $num = "<a href='edit-tags.php?taxonomy={$taxonomy->name}'>{$num}</a>";
            $text = "<a href='edit-tags.php?taxonomy={$taxonomy->name}'>{$text}</a>";
        }
        echo '<tr><td class="first b b-' . $taxonomy->name . '">' . $num . '</td>';
        echo '<td class="t ' . $taxonomy->name . '">' . $text . '</td></tr>';
    }
}
开发者ID:ashleycam3ron,项目名称:functions,代码行数:30,代码来源:dashboard.php


示例11: ajax_click_tags

 /**
  * Display a span list for click tags
  *
  * @return void
  * @author Amaury Balmer
  */
 public static function ajax_click_tags()
 {
     status_header(200);
     // Send good header HTTP
     header("Content-Type: text/html; charset=" . get_bloginfo('charset'));
     if ((int) wp_count_terms('post_tag', 'ignore_empty=false') == 0) {
         // No tags to suggest
         echo '<p>' . __('No terms in your WordPress database.', 'simpletags') . '</p>';
         exit;
     }
     // Prepare search
     $search = isset($_GET['q']) ? trim(stripslashes($_GET['q'])) : '';
     $post_id = isset($_GET['post_id']) ? intval($_GET['post_id']) : 0;
     // Order tags before selection (count-asc/count-desc/name-asc/name-desc/random)
     $order_click_tags = strtolower(SimpleTags_Plugin::get_option_value('order_click_tags'));
     $order_by = $order = '';
     switch ($order_click_tags) {
         case 'count-asc':
             $order_by = 'tt.count';
             $order = 'ASC';
             break;
         case 'random':
             $order_by = 'RAND()';
             $order = '';
             break;
         case 'count-desc':
             $order_by = 'tt.count';
             $order = 'DESC';
             break;
         case 'name-desc':
             $order_by = 't.name';
             $order = 'DESC';
             break;
         default:
             // name-asc
             $order_by = 't.name';
             $order = 'ASC';
             break;
     }
     // Get all terms, or filter with search
     $terms = SimpleTags_Admin::getTermsForAjax('post_tag', $search, $order_by, $order);
     if (empty($terms) || $terms == false) {
         echo '<p>' . __('No results from your WordPress database.', 'simpletags') . '</p>';
         exit;
     }
     // Get terms for current post
     $post_terms = array();
     if ($post_id > 0) {
         $post_terms = wp_get_post_terms($post_id, 'post_tag', array('fields' => 'ids'));
     }
     foreach ((array) $terms as $term) {
         $class_current = in_array($term->term_id, $post_terms) ? 'used_term' : '';
         echo '<span class="local ' . $class_current . '">' . esc_html(stripslashes($term->name)) . '</span>' . "\n";
     }
     echo '<div class="clear"></div>';
     exit;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:63,代码来源:class.admin.clickterms.php


示例12: getTotalPages

 public function getTotalPages()
 {
     if (isset($this->options["id"])) {
         return 1;
     }
     $total = wp_count_terms($this->taxonomy);
     $per_page = $this->options["per_page"];
     return round($total / $per_page, 0, PHP_ROUND_HALF_UP);
 }
开发者ID:cyberwani,项目名称:wpmvc,代码行数:9,代码来源:Taxonomy.php


示例13: _load_default_entries

 function _load_default_entries()
 {
     if (wp_count_terms($this->_var) > 0) {
         return;
     }
     foreach ((array) $this->_default_terms as $term => $args) {
         wp_insert_term($term, $this->_var, $args);
     }
 }
开发者ID:jimrucinski,项目名称:Vine,代码行数:9,代码来源:it-taxonomy.php


示例14: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        if (!empty($instance['title'])) {
            $title = $instance['title'];
        } else {
            $title = 'بىكەت ئۇچۇرى';
        }
        $title = apply_filters('widget_title', $title, $instance, $this->id_base);
        $date = $instance['date'];
        echo $before_widget;
        echo $before_title . $title . $after_title;
        echo '<ul class="blog_info">';
        if ($title) {
        }
        ?>
         

           <li>يازما سانى:<?php 
        $count_posts = wp_count_posts();
        echo $published_posts = $count_posts->publish;
        ?>
 </li>
           <li> بەت سانى:<?php 
        $count_pages = wp_count_posts('page');
        echo $page_posts = $count_pages->publish;
        ?>
</li>
           <li>ئومۇمىي باھا:<?php 
        $count_comments = get_comment_count();
        echo $count_comments['approved'];
        ?>
</li>
           <li>ئومۇمىي خەتكۈش:<?php 
        echo $count_tags = wp_count_terms('post_tag');
        ?>
 </li>
           <?php 
        if (!empty($instance['date'])) {
            ?>
           <li>قۇرۇلغان ۋاقىت:<?php 
            echo $date;
            ?>
</li>
           <li>بىكەت يېشى:<?php 
            echo floor((time() - strtotime("{$date}")) / 86400);
            ?>
 كۈن</li>
           <?php 
        }
        ?>
</ul>
		<?php 
        echo $after_widget;
    }
开发者ID:MenZil-Team,项目名称:gulzar,代码行数:56,代码来源:blog_info.php


示例15: init_fields

 /**
  * init_fields function.
  *
  * @access public
  * @return void
  */
 public static function init_fields()
 {
     if (self::$fields) {
         return;
     }
     self::$fields = apply_filters('submit_job_form_fields', array('job' => array('job_title' => array('label' => __('Job title', 'wp-job-manager'), 'type' => 'text', 'required' => true, 'placeholder' => '', 'priority' => 1), 'job_location' => array('label' => __('Job location', 'wp-job-manager'), 'description' => __('Leave this blank if the job can be done from anywhere (i.e. telecommuting)', 'wp-job-manager'), 'type' => 'text', 'required' => false, 'placeholder' => __('e.g. "London, UK", "New York", "Houston, TX"', 'wp-job-manager'), 'priority' => 2), 'job_type' => array('label' => __('Job type', 'wp-job-manager'), 'type' => 'select', 'required' => true, 'options' => self::job_types(), 'placeholder' => '', 'priority' => 3), 'job_category' => array('label' => __('Job category', 'wp-job-manager'), 'type' => 'select', 'required' => true, 'options' => self::job_categories(), 'placeholder' => '', 'priority' => 4), 'job_description' => array('label' => __('Description', 'wp-job-manager'), 'type' => 'wp-editor', 'required' => true, 'placeholder' => '', 'priority' => 5), 'application' => array('label' => __('Application email/URL', 'wp-job-manager'), 'type' => 'text', 'required' => true, 'placeholder' => __('Enter an email address or website URL', 'wp-job-manager'), 'priority' => 6)), 'company' => array('company_name' => array('label' => __('Company name', 'wp-job-manager'), 'type' => 'text', 'required' => true, 'placeholder' => __('Enter the name of the company', 'wp-job-manager'), 'priority' => 1), 'company_website' => array('label' => __('Website', 'wp-job-manager'), 'type' => 'text', 'required' => false, 'placeholder' => __('http://', 'wp-job-manager'), 'priority' => 2), 'company_tagline' => array('label' => __('Tagline', 'wp-job-manager'), 'type' => 'text', 'required' => false, 'placeholder' => __('Briefly describe your company', 'wp-job-manager'), 'maxlength' => 64, 'priority' => 3), 'company_twitter' => array('label' => __('Twitter username', 'wp-job-manager'), 'type' => 'text', 'required' => false, 'placeholder' => __('@yourcompany', 'wp-job-manager'), 'priority' => 4), 'company_logo' => array('label' => __('Logo', 'wp-job-manager'), 'type' => 'file', 'required' => false, 'placeholder' => '', 'priority' => 5))));
     if (!get_option('job_manager_enable_categories') || wp_count_terms('job_listing_category') == 0) {
         unset(self::$fields['job']['job_category']);
     }
 }
开发者ID:dot2006,项目名称:jobify,代码行数:16,代码来源:class-wp-job-manager-form-submit-job.php


示例16: woocommerce_content_right_now

/**
 * Right now widget hooks/content
 */
function woocommerce_content_right_now()
{
    global $woocommerce;
    ?>
	</table>
	<p class="sub woocommerce_sub"><?php 
    _e('Shop Content', 'woocommerce');
    ?>
</p>
	<table>
		<tr>
			<td class="first b"><a href="edit.php?post_type=product"><?php 
    $num_posts = wp_count_posts('product');
    $num = number_format_i18n($num_posts->publish);
    echo $num;
    ?>
</a></td>
			<td class="t"><a href="edit.php?post_type=product"><?php 
    _e('Products', 'woocommerce');
    ?>
</a></td>
		</tr>
		<tr>
			<td class="first b"><a href="edit-tags.php?taxonomy=product_cat&post_type=product"><?php 
    echo wp_count_terms('product_cat');
    ?>
</a></td>
			<td class="t"><a href="edit-tags.php?taxonomy=product_cat&post_type=product"><?php 
    _e('Product Categories', 'woocommerce');
    ?>
</a></td>
		</tr>
		<tr>
			<td class="first b"><a href="edit-tags.php?taxonomy=product_tag&post_type=product"><?php 
    echo wp_count_terms('product_tag');
    ?>
</a></td>
			<td class="t"><a href="edit-tags.php?taxonomy=product_tag&post_type=product"><?php 
    _e('Product Tags', 'woocommerce');
    ?>
</a></td>
		</tr>
		<tr>
			<td class="first b"><a href="admin.php?page=woocommerce_attributes"><?php 
    echo sizeof($woocommerce->get_attribute_taxonomies());
    ?>
</a></td>
			<td class="t"><a href="admin.php?page=woocommerce_attributes"><?php 
    _e('Attribute taxonomies', 'woocommerce');
    ?>
</a></td>
		</tr>
	<?php 
}
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:57,代码来源:woocommerce-admin-dashboard.php


示例17: show_tag_filter

 /**
  * Show the tag cloud
  */
 public function show_tag_filter($shortcode_atts)
 {
     if (isset($shortcode_atts['show_tags']) && ($shortcode_atts['show_tags'] === false || (string) $shortcode_atts['show_tags'] == 'false')) {
         return;
     }
     if (wp_count_terms('job_listing_tag') == 0) {
         return;
     }
     wp_enqueue_script('wp-job-manager-ajax-tag-filters', JOB_MANAGER_TAGS_PLUGIN_URL . '/assets/js/tag-filter.js', array('jquery'), '1.0', true);
     echo '<div class="filter_wide filter_by_tag">' . __('Filter by tag:', 'wp-job-manager-tags') . ' <span class="filter_by_tag_cloud"></span></div>';
 }
开发者ID:durichitayat,项目名称:befolio-wp,代码行数:14,代码来源:class-job-manager-job-tags-shortcodes.php


示例18: tags

 function tags($args)
 {
     $args['get'] = 'all';
     $tags = (array) get_tags($args);
     unset($args['offset']);
     $found = wp_count_terms('post_tag', $args);
     $tags_obj = array();
     foreach ($tags as $tag) {
         $tags_obj[] = $this->format_taxonomy($tag, 'post_tag', 'display');
     }
     return array('found' => $found, 'tags' => $tags_obj);
 }
开发者ID:moushegh,项目名称:blog-source-configs,代码行数:12,代码来源:class.wpcom-json-api-get-taxonomies-endpoint.php


示例19: ajaxClickTags

 /**
  * Display a span list for click tags
  *
  * @return void
  * @author Amaury Balmer
  */
 function ajaxClickTags()
 {
     status_header(200);
     // Send good header HTTP
     header("Content-Type: text/html; charset=" . get_bloginfo('charset'));
     if ((int) wp_count_terms('post_tag', 'ignore_empty=false') == 0) {
         // No tags to suggest
         echo '<p>' . __('No terms in your WordPress database.', 'simpletags') . '</p>';
         exit;
     }
     // Prepare search
     $search = isset($_GET['q']) ? trim(stripslashes($_GET['q'])) : '';
     // Get options
     $options = get_option(STAGS_OPTIONS_NAME);
     // Order tags before selection (count-asc/count-desc/name-asc/name-desc/random)
     $options['order_click_tags'] = strtolower($options['order_click_tags']);
     $order_by = $order = '';
     switch ($options['order_click_tags']) {
         case 'count-asc':
             $order_by = 'tt.count';
             $order = 'ASC';
             break;
         case 'random':
             $order_by = 'RAND()';
             $order = '';
             break;
         case 'count-desc':
             $order_by = 'tt.count';
             $order = 'DESC';
             break;
         case 'name-desc':
             $order_by = 't.name';
             $order = 'DESC';
             break;
         default:
             // name-asc
             $order_by = 't.name';
             $order = 'ASC';
             break;
     }
     // Get all terms, or filter with search
     $terms = $this->getTermsForAjax('post_tag', $search, $order_by, $order);
     if (empty($terms) || $terms == false) {
         echo '<p>' . __('No results from your WordPress database.', 'simpletags') . '</p>';
         exit;
     }
     foreach ((array) $terms as $term) {
         echo '<span class="local">' . esc_html(stripslashes($term->name)) . '</span>' . "\n";
     }
     echo '<div class="clear"></div>';
     exit;
 }
开发者ID:rubyerme,项目名称:rubyerme.github.com,代码行数:58,代码来源:class.admin.clickterms.php


示例20: _get_content

 protected function _get_content($args = array())
 {
     $args = wp_parse_args($args, array('include' => '', 'taxonomy' => 'category', 'number' => 20, 'orderby' => 'name', 'order' => 'ASC', 'offset' => 0));
     extract($args);
     if (!isset($paged)) {
         $paged = 1;
     }
     $terms = get_terms($taxonomy, array('number' => $number, 'hide_empty' => false, 'include' => $include, 'offset' => $number * ($paged - 1), 'orderby' => $orderby, 'order' => $order));
     $total_items = wp_count_terms($taxonomy, array('hide_empty' => false));
     $per_page = $number;
     $this->pagination = array('paged' => $offset + $paged, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page), 'total_items' => $total_items);
     return $terms;
 }
开发者ID:lieison,项目名称:IndustriasFenix,代码行数:13,代码来源:yit-layout-module-taxonomy.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wp_create_categories函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_count_posts函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap