本文整理汇总了PHP中wp_generate_tag_cloud函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_generate_tag_cloud函数的具体用法?PHP wp_generate_tag_cloud怎么用?PHP wp_generate_tag_cloud使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_generate_tag_cloud函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: generate_tag_cloud
function generate_tag_cloud($post_type)
{
global $wpdb;
// database calls must be sensitive to multisite
$query = $wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_type = %s", $post_type);
$attachment_ids = $wpdb->get_col($query);
$terms = wp_get_object_terms($attachment_ids, 'post_tag', array('orderby' => 'count', 'order' => 'DESC'));
$tags = array();
// limit to 45 tags
foreach ($terms as $term) {
$tags[$term->term_id] = $term;
if (count($tags) >= 45) {
break;
}
}
if (empty($tags)) {
die(__('No tags found!', THEMEDOMAIN));
}
if (is_wp_error($tags)) {
die($tags->get_error_message());
}
foreach ($tags as $key => $tag) {
$tags[$key]->link = '#';
$tags[$key]->id = $tag->term_id;
}
// We need raw tag names here, so don't filter the output
$return = wp_generate_tag_cloud($tags, array('filter' => 0));
if (empty($return)) {
die('0');
}
echo $return;
exit;
}
开发者ID:googlecode-mirror,项目名称:wpmu-demo,代码行数:33,代码来源:shiba-mlib-ajax.php
示例2: index_action
/**
* Displays the 'tagcloud' display type
*
* @param stdClass|C_Displayed_Gallery|C_DataMapper_Model $displayed_gallery
*/
function index_action($displayed_gallery, $return = FALSE)
{
$display_settings = $displayed_gallery->display_settings;
$application = $this->object->get_registry()->get_utility('I_Router')->get_routed_app();
$tag = $this->param('gallerytag');
// we're looking at a tag, so show images w/that tag as a thumbnail gallery
if (!is_home() && !empty($tag)) {
return $this->object->get_registry()->get_utility('I_Displayed_Gallery_Renderer')->display_images(array('source' => 'tags', 'container_ids' => array(esc_attr($tag)), 'display_type' => $display_settings['display_type'], 'original_display_type' => $displayed_gallery->display_type, 'original_settings' => $display_settings));
}
$defaults = array('exclude' => '', 'format' => 'list', 'include' => $displayed_gallery->get_term_ids_for_tags(), 'largest' => 22, 'link' => 'view', 'number' => $display_settings['number'], 'order' => 'ASC', 'orderby' => 'name', 'smallest' => 8, 'taxonomy' => 'ngg_tag', 'unit' => 'pt');
$args = wp_parse_args('', $defaults);
// Always query top tags
$tags = get_terms($args['taxonomy'], array_merge($args, array('orderby' => 'count', 'order' => 'DESC')));
foreach ($tags as $key => $tag) {
$tags[$key]->link = $this->object->set_param_for($application->get_routed_url(TRUE), 'gallerytag', $tag->slug);
$tags[$key]->id = $tag->term_id;
}
$params = $display_settings;
$params['inner_content'] = $displayed_gallery->inner_content;
$params['storage'] =& $storage;
$params['tagcloud'] = wp_generate_tag_cloud($tags, $args);
$params['displayed_gallery_id'] = $displayed_gallery->id();
$params = $this->object->prepare_display_parameters($displayed_gallery, $params);
return $this->object->render_partial('photocrati-nextgen_basic_tagcloud#nextgen_basic_tagcloud', $params, $return);
}
开发者ID:JeffreyBue,项目名称:jb,代码行数:30,代码来源:adapter.nextgen_basic_tagcloud_controller.php
示例3: test_topic_count_text_callback
public function test_topic_count_text_callback()
{
register_taxonomy('wptests_tax', 'post');
$terms = $this->factory->term->create_many(2, array('taxonomy' => 'wptests_tax'));
$posts = $this->factory->post->create_many(2);
wp_set_post_terms($posts[0], $terms, 'wptests_tax');
wp_set_post_terms($posts[1], array($terms[1]), 'wptests_tax');
$term_objects = $this->retrieve_terms(array('include' => $terms), 'wptests_tax');
$actual = wp_generate_tag_cloud($term_objects, array('format' => 'array', 'topic_count_text_callback' => array($this, 'topic_count_text_callback')));
$this->assertContains("title='1 foo'", $actual[0]);
$this->assertContains("title='2 foo'", $actual[1]);
}
开发者ID:Benrajalu,项目名称:philRaj,代码行数:12,代码来源:wpGenerateTagCloud.php
示例4: die
} else {
die('0');
}
$tags = get_terms($taxonomy, array('number' => 45, 'orderby' => 'count', 'order' => 'DESC'));
if (empty($tags)) {
die(__('No tags found!'));
}
if (is_wp_error($tags)) {
die($tags->get_error_message());
}
foreach ($tags as $key => $tag) {
$tags[$key]->link = '#';
$tags[$key]->id = $tag->term_id;
}
// We need raw tag names here, so don't filter the output
$return = wp_generate_tag_cloud($tags, array('filter' => 0));
if (empty($return)) {
die('0');
}
echo $return;
exit;
break;
case 'add-comment':
check_ajax_referer($action);
if (!current_user_can('edit_posts')) {
die('-1');
}
$search = isset($_POST['s']) ? $_POST['s'] : false;
$status = isset($_POST['comment_status']) ? $_POST['comment_status'] : 'all';
$per_page = isset($_POST['per_page']) ? (int) $_POST['per_page'] + 8 : 28;
$start = isset($_POST['page']) ? intval($_POST['page']) * $per_page - 1 : $per_page - 1;
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:31,代码来源:admin-ajax.php
示例5: wp_generate_tag_cloud
<div id="download-page-tags" class="download_group">
<h3>Taggar</h3>
<div class="download_tags">
<?php
echo wp_generate_tag_cloud($tags);
?>
</div>
</div>
开发者ID:melgar3d,项目名称:wpsvse,代码行数:8,代码来源:download-tags.php
示例6: install_dashboard
function install_dashboard()
{
?>
<p><?php
printf(__('Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> or upload a plugin in .zip format via <a href="%s">this page</a>.'), self_admin_url('plugin-install.php?tab=upload'));
?>
</p>
<h4><?php
_e('Search');
?>
</h4>
<?php
install_search_form(false);
?>
<h4><?php
_e('Popular tags');
?>
</h4>
<p class="install-help"><?php
_e('You may also browse based on the most popular tags in the Plugin Directory:');
?>
</p>
<?php
$api_tags = install_popular_tags();
echo '<p class="popular-tags">';
if (is_wp_error($api_tags)) {
echo $api_tags->get_error_message();
} else {
//Set up the tags in a way which can be interpreted by wp_generate_tag_cloud()
$tags = array();
foreach ((array) $api_tags as $tag) {
$tags[$tag['name']] = (object) array('link' => esc_url(self_admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name']))), 'name' => $tag['name'], 'id' => sanitize_title_with_dashes($tag['name']), 'count' => $tag['count']);
}
echo wp_generate_tag_cloud($tags, array('single_text' => __('%s plugin'), 'multiple_text' => __('%s plugins')));
}
echo '</p><br class="clear" />';
}
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:39,代码来源:plugin-install.php
示例7: nggTagCloud
/**
* nggTagCloud() - return a tag cloud based on the wp core tag cloud system
*
* @param array $args
* @param string $template (optional) name for a template file, look for gallery-$template
* @return the content
*/
function nggTagCloud($args = '', $template = '')
{
global $nggRewrite;
// $_GET from wp_query
$tag = get_query_var('gallerytag');
$pageid = get_query_var('pageid');
// look for gallerytag variable
if ($pageid == get_the_ID() || !is_home()) {
if (!empty($tag)) {
$slug = esc_attr($tag);
$out = nggShowGalleryTags($slug);
return $out;
}
}
$defaults = array('smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'ngg_tag');
$args = wp_parse_args($args, $defaults);
$tags = get_terms($args['taxonomy'], array_merge($args, array('orderby' => 'count', 'order' => 'DESC')));
// Always query top tags
foreach ($tags as $key => $tag) {
$tags[$key]->link = $nggRewrite->get_permalink(array('gallerytag' => $tag->slug));
$tags[$key]->id = $tag->term_id;
}
$out = '<div class="ngg-tagcloud">' . wp_generate_tag_cloud($tags, $args) . '</div>';
return $out;
}
开发者ID:popovdenis,项目名称:kmst,代码行数:32,代码来源:nggfunctions.php
示例8: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
echo '<div class="gtags gtags-widget">';
echo wp_generate_tag_cloud(gtags_make_tags(null, $instance['exclude'], $instance['include']), gtags_cloud_args());
echo '</div>';
echo $after_widget;
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:13,代码来源:bp-group-tags.php
示例9: test_should_include_tag_link_position_class
/**
* @ticket 5172
*/
public function test_should_include_tag_link_position_class()
{
register_taxonomy('wptests_tax', 'post');
$term_ids = self::factory()->term->create_many(3, array('taxonomy' => 'wptests_tax'));
$p = self::factory()->post->create();
wp_set_post_terms($p, $term_ids, 'wptests_tax');
$term_objects = get_terms('wptests_tax', array('include' => $term_ids));
$cloud = wp_generate_tag_cloud($term_objects);
preg_match_all('|tag\\-link\\-position-([0-9]+)|', $cloud, $matches);
$this->assertSame(array(1, 2, 3), array_map('intval', $matches[1]));
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:14,代码来源:wpGenerateTagCloud.php
示例10: widget
function widget($args, $instance)
{
global $site_categories, $current_site;
$site_categories->load_config();
extract($args);
$data = get_site_transient('site-categories-cloud-data-' . $this->number);
if (!$data) {
switch_to_blog($current_site->blog_id);
$defaults = array('smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true);
$instance = wp_parse_args($instance, $defaults);
if (isset($instance['category']) && intval($instance['category'])) {
$instance['child_of'] = $instance['category'];
}
$tags = get_terms(SITE_CATEGORIES_TAXONOMY, $instance);
// Always query top tags
if (isset($instance['include_parent']) && $instance['include_parent'] == "on") {
$parent_tag = get_term_by('id', $instance['category'], SITE_CATEGORIES_TAXONOMY);
if (!empty($parent_tag) && !is_wp_error($parent_tag)) {
//echo "parent_tag<pre>"; print_r($parent_tag); echo "</pre>";
$tags[] = $parent_tag;
}
}
if (empty($tags) || is_wp_error($tags)) {
return;
}
foreach ($tags as $key => $tag) {
$tags[$key]->id = $tag->term_id;
if (isset($site_categories->opts['landing_page_rewrite']) && $site_categories->opts['landing_page_rewrite'] == true) {
$tags[$key]->link = trailingslashit($site_categories->opts['landing_page_slug']) . $tag->slug;
} else {
$tags[$key]->link = $site_categories->opts['landing_page_slug'] . '&category_name=' . $tag->slug;
}
}
$data = wp_generate_tag_cloud($tags, $instance);
// Here's where those top tags get sorted according to $args
restore_current_blog();
set_site_transient('site-categories-cloud-data-' . $this->number, $data, 30);
}
if ($data) {
echo $before_widget;
$title = apply_filters('widget_title', $instance['title']);
if ($title) {
echo $before_title . $title . $after_title;
}
echo $data;
echo $after_widget;
}
}
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:48,代码来源:class_site_categories_widget_cloud.php
示例11: get_terms
<?php
//引入图片插件入口文件
require_once './wp-content/plugins/nextgen-gallery/ngg-config.php';
require_once './inc/php/cfg.php';
$tags = get_terms('ngg_tag');
foreach ($tags as $tag) {
$tag->link = $cfg['siteurl'] . 'tag/' . $tag->term_id . '-' . $tag->slug . '.html';
}
$args = array('smallest' => 20, 'largest' => 100, 'unit' => 'pt', 'number' => 100, 'format' => 'flat', 'orderby' => 'count', 'order' => 'RAND');
$tags_display = wp_generate_tag_cloud($tags, $args);
//页面title
$page_title = 'FOTO';
$title = 'Tags' . $cfg['sitetitle'];
require_once './inc/html/head.html';
?>
<div id='main'>
<?php
echo $tags_display;
?>
</div>
<?php
require_once './inc/html/foot.html';
开发者ID:pravinhirmukhe,项目名称:flow1,代码行数:23,代码来源:tags.php
示例12: install_themes_dashboard
function install_themes_dashboard()
{
?>
<p><?php
_e('Search for themes by keyword, author, or tag.');
?>
</p>
<?php
install_theme_search_form('<a href="' . add_query_arg('show-help', !isset($_REQUEST['show-help'])) . '" onclick="jQuery(\'#search-help\').toggle(); return false;">' . __('[need help?]') . '</a>');
?>
<div id="search-help" style="display: <?php
echo isset($_REQUEST['show-help']) ? 'block' : 'none';
?>
;">
<p><?php
_e('You may search based on 3 criteria:');
?>
<br />
<?php
_e('<strong>Term:</strong> Searches theme names and descriptions for the specified term');
?>
<br />
<?php
_e('<strong>Tag:</strong> Searches for themes tagged as such');
?>
<br />
<?php
_e('<strong>Author:</strong> Searches for themes created by the Author, or which the Author contributed to.');
?>
</p>
</div>
<h4><?php
_e('Advanced Search');
?>
</h4>
<p><?php
_e('Tag filter goes here');
?>
</p>
<h4><?php
_e('Popular tags');
?>
</h4>
<p><?php
_e('You may also browse based on the most popular tags in the Theme Directory:');
?>
</p>
<?php
$api_tags = install_themes_popular_tags();
//Set up the tags in a way which can be interprated by wp_generate_tag_cloud()
$tags = array();
foreach ((array) $api_tags as $tag) {
$tags[$tag['name']] = (object) array('link' => clean_url(admin_url('theme-install.php?tab=search&type=tag&s=' . urlencode($tag['name']))), 'name' => $tag['name'], 'id' => sanitize_title_with_dashes($tag['name']), 'count' => $tag['count']);
}
echo '<p>';
echo wp_generate_tag_cloud($tags, array('single_text' => __('%d theme'), 'multiple_text' => __('%d themes')));
echo '</p><br class="clear" />';
}
开发者ID:schr,项目名称:wordpress,代码行数:61,代码来源:theme-install.php
示例13: widget
public function widget($args, $instance)
{
$cache = array();
if (!$this->is_preview()) {
$cache = wp_cache_get('stt2extat_widget_terms_list', 'widget');
}
if (!is_array($cache)) {
$cache = array();
}
if (!isset($args['widget_id'])) {
$args['widget_id'] = $this->id;
}
if (isset($cache[$args['widget_id']])) {
echo $cache[$args['widget_id']];
return;
}
ob_start();
$title = __('Popular Terms', 'stt2extat');
$post_id = null;
$sort = isset($instance['sort']) ? $instance['sort'] : 'count';
$obj = get_queried_object();
$tax = $cloud = false;
$tax_query = $args_cloud = array();
switch ($sort) {
case 'taxonomy':
if (!isset($obj->term_id)) {
return null;
}
$title .= ' in ' . $obj->name;
$tax_query = array('tax_query' => array('tax_query' => array(array('taxonomy' => $obj->taxonomy, 'terms' => $obj->term_id))));
$sort = 'count';
$tax = true;
break;
case 'post_id':
if (!is_single()) {
return null;
}
$title .= __(' Post', 'stt2extat');
$post_id = $obj->ID;
$sort = 'count';
break;
case 'term_id':
$title = __('Recent Terms', 'stt2extat');
break;
case 'recent':
if (!is_single()) {
return null;
}
$title = __('Recent Terms Post', 'stt2extat');
$post_id = $obj->ID;
$sort = 'term_id';
break;
case 'term_cloud':
$title = __('Term Cloud', 'stt2extat');
$args_cloud = apply_filters('stt2extat_tag_cloud_args', array());
$sort = 'count';
$cloud = true;
break;
default:
$title = $title;
break;
}
$title = apply_filters('widget_title', empty($instance['title']) ? $title : $instance['title'], $instance, $this->id_base);
$interval = isset($instance['interval']) ? $instance['interval'] : 'all';
$number = isset($instance['number']) ? $instance['number'] : 5;
$count = isset($instance['count']) ? $instance['count'] : 'tooltips';
$convert = isset($instance['convert']) ? $instance['convert'] : 'n';
$args_query = array('sort' => $sort, 'number' => $number, 'order' => 'DESC', 'p' => $post_id);
$args_interval = apply_filters('stt2extat_widget_interval_time', array('date_query' => array('after' => $interval)));
if ('all' != $interval) {
$args_query = wp_parse_args($args_interval, $args_query);
}
if ('count' == $sort && $tax) {
$args_query = wp_parse_args($tax_query, $args_query);
}
$set = array('text_header' => '', 'html_heading' => '', 'display' => 'ul', 'count' => $count, 'convert' => $convert);
$args_query = wp_parse_args($args_query, $set);
$result = stt2extat_terms_list($args_query, $widget = (object) array('is_widget' => true, 'cloud' => wp_validate_boolean($cloud)));
if ('count' == $sort && $cloud) {
unset($args_cloud['number']);
// use args_query['number']
$args_cloud['filter'] = false;
$args_cloud['topic_count_text'] = _n_noop('%s hit', '%s hits');
if (has_filter('stt2extat_term_count', 'stt2extat_count_posts')) {
$args_cloud['topic_count_text'] = _n_noop('%s topic', '%s topics');
}
if ('n' == $args_query['count']) {
$args_cloud['topic_count_text'] = '';
}
$result = wp_generate_tag_cloud($result, $args_cloud);
}
if (!empty($result)) {
echo $args['before_widget'];
if ($title) {
echo $args['before_title'] . $title . $args['after_title'];
}
echo $result;
echo $args['after_widget'];
}
if (!$this->is_preview()) {
//.........这里部分代码省略.........
开发者ID:Jevuska,项目名称:stt2-extension-add-terms,代码行数:101,代码来源:widgets.php
示例14: the_content
the_content(__('› Continue reading'));
the_tags('<p class="tags">Tags: ', ', ', '</p>');
edit_post_link('[edit post]', '<p>', '</p>');
the_time('l, F jS, Y');
the_category(', ');
comments_popup_link(__('No Comments'), __('1 Comment'), __('% Comments'));
}
next_posts_link('« Previous Entries');
?>
<?php
previous_posts_link('Next Entries »');
} else {
?>
<h3>Not found!</h3>
<p><?php
_e('Sorry, no posts matched your criteria.');
?>
</p>
<?php
include TEMPLATEPATH . "/searchform.php";
}
?>
<br>
<?php
wp_generate_tag_cloud();
wp_tag_cloud();
?>
<br>
</div>
</td></tr></table>
<? include("footer.php"); ?>
开发者ID:JoshAshby,项目名称:LinuxandSci-Wordpress-Theme,代码行数:31,代码来源:index.php
示例15: wp_tag_cloud
/**
* This function mimics the WordPress function wp_tag_cloud()
* because we cannot hook into the function without receiving errors.
*
* As of 1.1, you can define 'link' as 'cpt_post' if you want the term's
* link to take you to the CPT's post page instead of the term archive.
*
* @since 1.0
* @uses $cpt_onomy
* @param array|string $args Optional. Override default arguments.
* @return array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument.
*/
public function wp_tag_cloud($args = NULL)
{
global $cpt_onomy;
$defaults = array('smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true);
$args = wp_parse_args($args, $defaults);
$tags = get_terms($args['taxonomy'], array_merge($args, array('orderby' => 'count', 'order' => 'DESC')));
// Always query top tags
if (empty($tags) || is_wp_error($tags)) {
return;
}
foreach ($tags as $key => $tag) {
if ('edit' == $args['link']) {
$link = $cpt_onomy->get_edit_term_link($tag->term_id, $tag->taxonomy);
} elseif ('cpt_post' == $args['link']) {
$link = get_permalink($tag->term_id);
} else {
$link = $cpt_onomy->get_term_link(intval($tag->term_id), $tag->taxonomy);
}
if (is_wp_error($link)) {
return false;
}
$tags[$key]->link = $link;
$tags[$key]->id = $tag->term_id;
}
$return = wp_generate_tag_cloud($tags, $args);
// Here's where those top tags get sorted according to $args
$return = apply_filters('wp_tag_cloud', $return, $args);
if ('array' == $args['format'] || empty($args['echo'])) {
return $return;
}
echo $return;
}
开发者ID:aarongillett,项目名称:B22-151217,代码行数:44,代码来源:cpt-onomy.php
示例16: install_dashboard
function install_dashboard()
{
?>
<p><?php
_e('Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> or upload a plugin in .zip format via this page.');
?>
</p>
<h4><?php
_e('Search');
?>
</h4>
<?php
install_search_form('<a href="' . add_query_arg('show-help', !isset($_REQUEST['show-help'])) . '" onclick="jQuery(\'#search-help\').toggle(); return false;">' . __('[need help?]') . '</a>');
?>
<div id="search-help" style="display: <?php
echo isset($_REQUEST['show-help']) ? 'block' : 'none';
?>
;">
<p> <?php
_e('You may search based on 3 criteria:');
?>
<br />
<?php
_e('<strong>Term:</strong> Searches plugins names and descriptions for the specified term');
?>
<br />
<?php
_e('<strong>Tag:</strong> Searches for plugins tagged as such');
?>
<br />
<?php
_e('<strong>Author:</strong> Searches for plugins created by the Author, or which the Author contributed to.');
?>
</p>
</div>
<h4><?php
_e('Install a plugin in .zip format');
?>
</h4>
<p><?php
_e('If you have a plugin in a .zip format, You may install it by uploading it here.');
?>
</p>
<form method="post" enctype="multipart/form-data" action="<?php
echo admin_url('plugin-install.php?tab=upload');
?>
">
<?php
wp_nonce_field('plugin-upload');
?>
<input type="file" name="pluginzip" />
<input type="submit" class="button" value="<?php
_e('Install Now');
?>
" />
</form>
<h4><?php
_e('Popular tags');
?>
</h4>
<p><?php
_e('You may also browse based on the most popular tags in the Plugin Directory:');
?>
</p>
<?php
$api_tags = install_popular_tags();
//Set up the tags in a way which can be interprated by wp_generate_tag_cloud()
$tags = array();
foreach ((array) $api_tags as $tag) {
$tags[$tag['name']] = (object) array('link' => clean_url(admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name']))), 'name' => $tag['name'], 'id' => sanitize_title_with_dashes($tag['name']), 'count' => $tag['count']);
}
echo '<p>';
echo wp_generate_tag_cloud($tags, array('single_text' => __('%d plugin'), 'multiple_text' => __('%d plugins')));
echo '</p><br class="clear" />';
}
开发者ID:schr,项目名称:wordpress,代码行数:78,代码来源:plugin-install.php
示例17: wp_tag_cloud
/**
* Display tag cloud.
*
* The text size is set by the 'smallest' and 'largest' arguments, which will
* use the 'unit' argument value for the CSS text size unit. The 'format'
* argument can be 'flat' (default), 'list', or 'array'. The flat value for the
* 'format' argument will separate tags with spaces. The list value for the
* 'format' argument will format the tags in a UL HTML list. The array value for
* the 'format' argument will return in PHP array type format.
*
* The 'orderby' argument will accept 'name' or 'count' and defaults to 'name'.
* The 'order' is the direction to sort, defaults to 'ASC' and can be 'DESC'.
*
* The 'number' argument is how many tags to return. By default, the limit will
* be to return the top 45 tags in the tag cloud list.
*
* The 'topic_count_text_callback' argument is a function, which, given the count
* of the posts with that tag, returns a text for the tooltip of the tag link.
*
* The 'exclude' and 'include' arguments are used for the {@link get_tags()}
* function. Only one should be used, because only one will be used and the
* other ignored, if they are both set.
*
* @since 2.3.0
*
* @param array|string $args Optional. Override default arguments.
* @return array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument.
*/
function wp_tag_cloud($args = '')
{
$defaults = array('smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '', 'link' => 'view');
$args = wp_parse_args($args, $defaults);
$tags = get_tags(array_merge($args, array('orderby' => 'count', 'order' => 'DESC')));
// Always query top tags
if (empty($tags)) {
return;
}
foreach ($tags as $key => $tag) {
if ('edit' == $args['link']) {
$link = get_edit_tag_link($tag->term_id);
} else {
$link = get_tag_link($tag->term_id);
}
if (is_wp_error($link)) {
return false;
}
$tags[$key]->link = $link;
$tags[$key]->id = $tag->term_id;
}
$return = wp_generate_tag_cloud($tags, $args);
// Here's where those top tags get sorted according to $args
$return = apply_filters('wp_tag_cloud', $return, $args);
if ('array' == $args['format']) {
return $return;
}
echo $return;
}
开发者ID:SymbiSoft,项目名称:litprojects,代码行数:57,代码来源:category-template.php
示例18: install_dashboard
/**
* @since 2.7.0
*/
function install_dashboard()
{
?>
<p><?php
printf(__('Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="%1$s">WordPress Plugin Directory</a> or upload a plugin in .zip format by clicking the button at the top of this page.'), 'https://wordpress.org/plugins/');
?>
</p>
<?php
display_plugins_table();
?>
<div class="plugins-popular-tags-wrapper">
<h2><?php
_e('Popular tags');
?>
</h2>
<p><?php
_e('You may also browse based on the most popular tags in the Plugin Directory:');
?>
</p>
<?php
$api_tags = install_popular_tags();
echo '<p class="popular-tags">';
if (is_wp_error($api_tags)) {
echo $api_tags->get_error_message();
} else {
//Set up the tags in a way which can be interpreted by wp_generate_tag_cloud()
$tags = array();
foreach ((array) $api_tags as $tag) {
$url = self_admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name']));
$data = array('link' => esc_url($url), 'name' => $tag['name'], 'slug' => $tag['slug'], 'id' => sanitize_title_with_dashes($tag['name']), 'count' => $tag['count']);
$tags[$tag['name']] = (object) $data;
}
echo wp_generate_tag_cloud($tags, array('single_text' => __('%s plugin'), 'multiple_text' => __('%s plugins')));
}
echo '</p><br class="clear" /></div>';
}
开发者ID:Garth619,项目名称:Femi9,代码行数:41,代码来源:plugin-install.php
示例19: wp_idea_stream_generate_tag_cloud
/**
* Generates an ideas tag cloud
*
* Used when writing a new idea to allow the author to choose
* one or more popular idea tags.
*
* @package WP Idea Stream
* @subpackage core/functions
*
* @since 2.0.0
*
* @param integer $number number of tag to display
* @param array $args the tag cloud args
* @uses get_terms()
* @uses wp_idea_stream_get_tag()
* @uses wp_parse_args()
* @uses wp_idea_stream_tag_cloud_args()
* @uses wp_generate_tag_cloud()
* @return array associative array containing the number of tags and the content of the cloud.
*/
function wp_idea_stream_generate_tag_cloud($number = 10, $args = array())
{
$tags = get_terms(wp_idea_stream_get_tag(), apply_filters('wp_idea_stream_generate_tag_cloud_args', array('number' => $number, 'orderby' => 'count', 'order' => 'DESC')));
if (empty($tags)) {
return;
}
foreach ($tags as $key => $tag) {
$tags[$key]->link = '#';
$tags[$key]->id = $tag->term_id;
}
$args = wp_parse_args($args, wp_idea_stream_tag_cloud_args(array('taxonomy' => wp_idea_stream_get_tag())));
$retarray = array('number' => count($tags), 'tagcloud' => wp_generate_tag_cloud($tags, $args));
return apply_filters('wp_idea_stream_generate_tag_cloud', $retarray);
}
开发者ID:BoweFrankema,项目名称:wp-idea-stream,代码行数:34,代码来源:functions.php
示例20: wp_tag_cloud
function wp_tag_cloud($args = '')
{
$defaults = array('smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '');
$args = wp_parse_args($args, $defaults);
$tags = get_tags(array_merge($args, array('orderby' => 'count', 'order' => 'DESC')));
// Always query top tags
if (empty($tags)) {
return;
}
$return = wp_generate_tag_cloud($tags, $args);
// Here's where those top tags get sorted according to $args
if (is_wp_error($return)) {
return false;
} else {
echo apply_filters('wp_tag_cloud', $return, $args);
}
}
开发者ID:helmonaut,项目名称:owb-mirror,代码行数:17,代码来源:category-template.php
注:本文中的wp_generate_tag_cloud函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论