本文整理汇总了PHP中wp_tag_cloud函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_tag_cloud函数的具体用法?PHP wp_tag_cloud怎么用?PHP wp_tag_cloud使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_tag_cloud函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: display_cloud_tag
function display_cloud_tag()
{
//echo '<script src="jquery.js" type="text/javascript">;
$options['cloud_tag_width'] = get_option('cloud_tag_width');
$options['tag_cloud_height'] = get_option('tag_cloud_height');
$options['tag_cloud_background_color'] = get_option('tag_cloud_background_color');
if (isset($options['cloud_tag_width']) && $options['cloud_tag_width'] != "") {
$options['cloud_tag_width'] = $options['cloud_tag_width'];
} else {
$options['cloud_tag_width'] = 300;
}
if (isset($options['tag_cloud_height']) && $options['tag_cloud_height'] != "") {
$options['tag_cloud_height'] = $options['tag_cloud_height'];
} else {
$options['tag_cloud_height'] = 300;
}
if (isset($options['tag_cloud_background_color']) && $options['tag_cloud_background_color'] != "") {
$options['tag_cloud_background_color'] = '#' . $options['tag_cloud_background_color'];
} else {
$options['tag_cloud_background_color'] = '#000';
}
echo '<div id="div_tag_cloud" style="width:' . $options['cloud_tag_width'] . 'px;height:' . $options['tag_cloud_height'] . 'px; word-wrap: break-word;">';
echo '<canvas width="' . $options['cloud_tag_width'] . 'px" height="' . $options['tag_cloud_height'] . 'px" id="myCanvas" style="background-color:' . $options['tag_cloud_background_color'] . ';">';
//wp_tag_cloud( $args = array('format'=> 'flat') );
$tag = wp_tag_cloud('smallest=14&largest=30&number=50&orderby=count&format=array');
foreach ($tag as $tags) {
echo "{$tags} ";
}
echo '</canvas>';
echo '</div>';
}
开发者ID:revathskumar,项目名称:Coderepo,代码行数:31,代码来源:wp-tagcloud.php
示例2: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$taxonomy = $instance['taxonomy'];
$format = $instance['format'];
$order = $instance['order'];
$orderby = $instance['orderby'];
$unit = $instance['unit'];
$largest = (int) $instance['largest'];
$smallest = (int) $instance['smallest'];
$number = (int) $instance['number'];
$exclude = $instance['exclude'];
$include = $instance['include'];
$link = $instance['link'];
if (!$largest) {
$largest = 22;
}
if (!$smallest) {
$smallest = 8;
}
$tags = array('taxonomy' => $taxonomy, 'smallest' => $smallest, 'largest' => $largest, 'unit' => $unit, 'number' => $number, 'format' => $format, 'orderby' => $orderby, 'order' => $order, 'exclude' => $exclude, 'include' => $include, 'link' => $link, 'echo' => 0);
echo "\n\t\t\t" . $before_widget;
if ($title) {
echo "\n\t\t\t\t" . $before_title . $title . $after_title;
}
if ($format == 'flat') {
echo "\n\t\t\t\t" . '<p class="tag-cloud">';
echo "\n\t\t\t\t\t" . str_replace(array("\r", "\n", "\t"), ' ', wp_tag_cloud($tags));
echo "\n\t\t\t\t" . '</p><!-- .tag-cloud -->';
} else {
echo "\n\t\t\t\t" . str_replace(array("\r", "\n", "\t"), '', wp_tag_cloud($tags));
}
echo "\n\t\t\t" . $after_widget;
}
开发者ID:sudar,项目名称:rolopress-core,代码行数:35,代码来源:tags.php
示例3: widget
function widget($args, $instance)
{
//get theme options
if (isset($instance['title'])) {
$title = $instance['title'];
} else {
$title = __('Tags', 'dfd');
}
if (isset($instance['number'])) {
$number = $instance['number'];
}
extract($args);
/* show the widget content without any headers or wrappers */
echo $before_widget;
if ($title) {
echo $before_title;
echo $title;
echo $after_title;
}
?>
<div class="tags-widget clearfix">
<?php
wp_tag_cloud('smallest=10&largest=20&number=' . $number);
?>
</div>
<?php
echo $after_widget;
}
开发者ID:sabdev1,项目名称:ljcdevsab,代码行数:29,代码来源:widget-tags.php
示例4: widget
/**
* Outputs the widget based on the arguments input through the widget controls.
* @since 0.6
*/
function widget($args, $instance)
{
extract($args);
/* Set up the arguments for wp_tag_cloud(). */
$args = array('taxonomy' => $instance['taxonomy'], 'largest' => !empty($instance['largest']) ? absint($instance['largest']) : 22, 'smallest' => !empty($instance['smallest']) ? absint($instance['smallest']) : 8, 'number' => intval($instance['number']), 'child_of' => intval($instance['child_of']), 'parent' => !empty($instance['parent']) ? intval($instance['parent']) : '', 'separator' => !empty($instance['separator']) ? $instance['separator'] : "\n", 'pad_counts' => !empty($instance['pad_counts']) ? true : false, 'hide_empty' => !empty($instance['hide_empty']) ? true : false, 'unit' => $instance['unit'], 'format' => $instance['format'], 'include' => !empty($instance['include']) ? join(', ', $instance['include']) : '', 'exclude' => !empty($instance['exclude']) ? join(', ', $instance['exclude']) : '', 'order' => $instance['order'], 'orderby' => $instance['orderby'], 'link' => $instance['link'], 'search' => $instance['search'], 'name__like' => $instance['name__like'], 'echo' => false);
if (!empty($instance['topic_count_text_callback']) && function_exists($instance['topic_count_text_callback'])) {
$args['topic_count_text_callback'] = $instance['topic_count_text_callback'];
}
if (!empty($instance['topic_count_scale_callback']) && function_exists($instance['topic_count_scale_callback'])) {
$args['topic_count_scale_callback'] = $instance['topic_count_scale_callback'];
}
/* Output the theme's $before_widget wrapper. */
echo $before_widget;
/* If a title was input by the user, display it. */
if (!empty($instance['title'])) {
echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
}
/* Get the tag cloud. */
$tags = str_replace(array("\r", "\n", "\t"), ' ', wp_tag_cloud($args));
/* If $format should be flat, wrap it in the <p> element. */
if ('flat' == $instance['format']) {
$tags = '<p class="' . $instance['taxonomy'] . '-cloud term-cloud">' . $tags . '</p>';
}
/* Output the tag cloud. */
echo $tags;
/* Close the theme's widget wrapper. */
echo $after_widget;
}
开发者ID:nukulb,项目名称:bugsbounty-blog,代码行数:32,代码来源:widget-tags.php
示例5: widget
/**
* Outputs the widget based on the arguments input through the widget controls.
*
* @since 0.6.0
*/
function widget($sidebar, $instance)
{
extract($sidebar);
/* Set the $args for wp_tag_cloud() to the $instance array. */
$args = $instance;
/* Make sure empty callbacks aren't passed for custom functions. */
$args['topic_count_text_callback'] = !empty($args['topic_count_text_callback']) ? $args['topic_count_text_callback'] : 'default_topic_count_text';
$args['topic_count_scale_callback'] = !empty($args['topic_count_scale_callback']) ? $args['topic_count_scale_callback'] : 'default_topic_count_scale';
/* If the separator is empty, set it to the default new line. */
$args['separator'] = !empty($args['separator']) ? $args['separator'] : "\n";
/* Overwrite the echo argument. */
$args['echo'] = false;
/* Output the theme's $before_widget wrapper. */
echo $before_widget;
/* If a title was input by the user, display it. */
if (!empty($instance['title'])) {
echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
}
/* Get the tag cloud. */
$tags = str_replace(array("\r", "\n", "\t"), ' ', wp_tag_cloud($args));
/* If $format should be flat, wrap it in the <p> element. */
if ('flat' == $instance['format']) {
$classes = array('term-cloud');
foreach ($instance['taxonomy'] as $tax) {
$classes[] = sanitize_html_class("{$tax}-cloud");
}
$tags = '<p class="' . join($classes, ' ') . '">' . $tags . '</p>';
}
/* Output the tag cloud. */
echo $tags;
/* Close the theme's widget wrapper. */
echo $after_widget;
}
开发者ID:VadimSid,项目名称:thinkgreek,代码行数:38,代码来源:widget-tags.php
示例6: widget
function widget($args, $instance)
{
$before_widget = $before_title = $after_title = $after_widget = '';
extract($args);
$current_taxonomy = $this->_get_current_taxonomy($instance);
if (!empty($instance['title'])) {
$title = $instance['title'];
} else {
if ('post_tag' == $current_taxonomy) {
$title = __('Tags', 'zn_framework');
} else {
$tax = get_taxonomy($current_taxonomy);
$title = $tax->labels->name;
}
}
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
echo '<div class="tagcloud">';
wp_tag_cloud(apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy, 'smallest' => '75', 'largest' => '200', 'unit' => '%')));
echo "</div>\n";
echo $after_widget;
}
开发者ID:rock1media,项目名称:wordpress,代码行数:25,代码来源:widget-tag-cloud.php
示例7: tag_cloud_block
function tag_cloud_block($options)
{
$mydirname = empty($options[0]) ? 'xpress' : $options[0];
$this_template = empty($options[1]) ? 'db:' . $mydirname . '_block_meta.html' : trim($options[1]);
$smallest = !is_numeric($options[2]) ? 8 : $options[2];
$largest = !is_numeric($options[3]) ? 22 : $options[3];
$unit = empty($options[4]) ? 'pt' : $options[4];
$number = !is_numeric($options[5]) ? 45 : $options[5];
$format = empty($options[6]) ? 'flat' : $options[6];
$orderby = empty($options[7]) ? 'name' : $options[7];
$order = empty($options[8]) ? 'ASC' : $options[8];
$exclude = is_null($options[9]) ? '' : $options[9];
$wp_include = is_null($options[10]) ? '' : $options[10];
$param = array('smallest' => $smallest, 'largest' => $largest, 'unit' => $unit, 'number' => $number, 'format' => $format, 'orderby' => $orderby, 'order' => $order, 'exclude' => $exclude, 'include' => $wp_include);
if (function_exists('wp_tag_cloud')) {
ob_start();
wp_tag_cloud($param);
$output = ob_get_contents();
ob_end_clean();
} else {
$output = 'not function wp_tag_cloud()';
}
$block['tag_cloud'] = $output;
return $block;
}
开发者ID:nouphet,项目名称:rata,代码行数:25,代码来源:tag_cloud_block_theme.php
示例8: widget
/**
* @param array $args
* @param array $instance
*/
public function widget($args, $instance)
{
$current_taxonomy = $this->_get_current_taxonomy($instance);
if (!empty($instance['title'])) {
$title = $instance['title'];
} else {
if ('post_tag' == $current_taxonomy) {
$title = __('Tags');
} else {
$tax = get_taxonomy($current_taxonomy);
$title = $tax->labels->name;
}
}
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
echo $args['before_widget'];
if ($title) {
echo $args['before_title'] . $title . $args['after_title'];
}
echo '<div class="tagcloud">';
/**
* Filter the taxonomy used in the Tag Cloud widget.
*
* @since 2.8.0
* @since 3.0.0 Added taxonomy drop-down.
*
* @see wp_tag_cloud()
*
* @param array $current_taxonomy The taxonomy to use in the tag cloud. Default 'tags'.
*/
wp_tag_cloud(apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy)));
echo "</div>\n";
echo $args['after_widget'];
}
开发者ID:Nickcooperper,项目名称:WordPress,代码行数:38,代码来源:class-wp-widget-tag-cloud.php
示例9: widget
function widget($args, $widgetData)
{
extract($args);
//=======> Our variables from the widget settings.
$kbe_widget_tag_title = $widgetData['txtKbeTagsHeading'];
$kbe_widget_tag_count = $widgetData['txtKbeTagsCount'];
$kbe_widget_tag_style = $widgetData['txtKbeTagsStyle'];
//=======> widget body
echo $before_widget;
echo '<div class="kbe_widget kbe_widget_article">';
if ($kbe_widget_tag_title) {
echo '<h2>' . $kbe_widget_tag_title . '</h2>';
}
?>
<div class="kbe_tags_widget">
<?php
$args = array('smallest' => 12, 'largest' => 30, 'unit' => 'px', 'number' => $kbe_widget_tag_count, 'format' => $kbe_widget_tag_style, 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', 'exclude' => null, 'include' => null, 'topic_count_text_callback' => default_topic_count_text, 'link' => 'view', 'taxonomy' => KBE_POST_TAGS, 'echo' => true);
wp_tag_cloud($args);
wp_reset_query();
?>
</div>
<?php
echo "</div>";
echo $after_widget;
}
开发者ID:helgatheviking,项目名称:wp-knowledgebase,代码行数:25,代码来源:kbe_widget_tags.php
示例10: widget
/**
* How to display the widget on the screen.
*/
function widget($args, $instance)
{
extract($args);
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', $instance['title']);
$number = $instance['number'];
/* Before widget (defined by themes). */
echo $before_widget;
/* Display the widget title if one was input (before and after defined by themes). */
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<div class="tag-cloud">
<?php
wp_tag_cloud(array('smallest' => 12, 'largest' => 12, 'unit' => 'px', 'number' => $number, 'orderby' => 'count', 'order' => 'DESC'));
?>
</div>
<?php
/* After widget (defined by themes). */
echo $after_widget;
}
开发者ID:benquinney,项目名称:WOD-Magazine-Custom-Braxton-theme,代码行数:29,代码来源:widget-tags.php
示例11: widget
/**
* How to display the widget on the screen.
*/
function widget($args, $instance)
{
extract($args);
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', $instance['title']);
/* Before widget (defined by themes). */
echo $before_widget;
/* Display the widget title if one was input (before and after defined by themes). */
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<div class="tag-cloud">
<?php
wp_tag_cloud('smallest=12&largest=12&unit=px&number=40&orderby=count&order=DESC');
?>
</div>
<?php
/* After widget (defined by themes). */
echo $after_widget;
}
开发者ID:khanhnd91,项目名称:mcha.vn,代码行数:29,代码来源:widget-tags.php
示例12: widget
public function widget($args, $instance)
{
extract($args);
$current_taxonomy = $this->_get_current_taxonomy($instance);
if (!empty($instance['title'])) {
$title = $instance['title'];
} else {
if ('post_tag' == $current_taxonomy) {
$title = 'Tags';
} else {
$tax = get_taxonomy($current_taxonomy);
$title = $tax->labels->name;
}
}
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
$before_widget = '<div class="widget-container kk_widget_tag_cloud">';
$after_widget = '</div>';
$before_title = '<h1 class="widget-title">';
$after_title = '</h1>';
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
echo '<div class="kk_tagcloud">';
wp_tag_cloud(apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy)));
echo "</div>\n";
echo $after_widget;
}
开发者ID:csp5096,项目名称:PBR-World.com,代码行数:28,代码来源:kk_tag_cloud_widget.php
示例13: widget
/**
* Widget
* Display the widget in the sidebar
*
* @param array sidebar arguments
* @param array instance
*/
public function widget($args, $instance)
{
// Get the widget cache from the transient
$cache = get_transient('fflcommerce_widget_cache');
// If this tag cloud widget instance is cached, get from the cache
if (isset($cache[$this->id])) {
echo $cache[$this->id];
return false;
}
// Otherwise Start buffering and output the Widget
ob_start();
// Extract the widget arguments
extract($args);
// Set the widget title
$title = !empty($instance['title']) ? $instance['title'] : __('Product Tags', 'fflcommerce');
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
// Print the widget wrapper & title
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
// Print tag cloud with wrapper
echo '<div class="tagcloud">';
wp_tag_cloud(apply_filters('widget_tag_cloud_args', array('taxonomy' => 'product_tag')));
echo "</div>\n";
// Print closing widget wrapper
echo $after_widget;
// Flush output buffer and save to transient cache
$result = ob_get_flush();
$cache[$this->id] = $result;
set_transient('fflcommerce_widget_cache', $cache, 3600 * 3);
// 3 hours ahead
}
开发者ID:barnent1,项目名称:fflcommerce,代码行数:40,代码来源:product_tag_cloud.php
示例14: widget
function widget($args, $instance)
{
extract($args);
$current_taxonomy = $this->_get_current_taxonomy($instance);
if (!empty($instance['title'])) {
$title = $instance['title'];
} else {
if ('post_tag' == $current_taxonomy) {
$title = __('Tags', 'tfuse');
} else {
$tax = get_taxonomy($current_taxonomy);
$title = $tax->labels->name;
}
}
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
$before_widget = '<div id="tag_cloud-' . $args['widget_id'] . '" class="widget-container widget_tag_cloud">';
$after_widget = '</div>';
$before_title = '<h3 class="widget-title">';
$after_title = '</h3>';
echo $before_widget;
$title = tfuse_qtranslate($title);
if ($title) {
echo $before_title . $title . $after_title;
}
echo '<div class="tagcloud">';
wp_tag_cloud(apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy)));
echo "</div>\n";
echo $after_widget;
}
开发者ID:shimion,项目名称:stlucks,代码行数:29,代码来源:TF_Widget_Tag_Cloud.php
示例15: widget
/**
* load widget
*
* @name widget
* @author Cleber Santos <[email protected]>
* @since 2014-10-27
* @updated 2014-10-27
* @param array $args - widget structure
* @param array $instance - widget data
* @return void
*/
function widget($args, $instance)
{
global $wpdb, $post;
$blog_id = !empty($instance['blog']) ? $instance['blog'] : 1;
if (function_exists('switch_to_blog')) {
switch_to_blog($blog_id);
}
// pega o link do blog
$blog_url = get_bloginfo('url');
print $args['before_widget'];
if (!empty($instance['title'])) {
print $args['before_head'];
print "<a href='{$blog_url}' title='click para ver todas as tags'>" . $args['before_title'] . $instance['title'] . $args['after_title'] . "</a>";
print $args['after_head'];
}
print $args['before_body'];
if (function_exists('wp_tag_cloud')) {
$tags = wp_tag_cloud('format=array&smallest=8&largest=25');
// remove /blog/ do link
foreach ($tags as $tag) {
$tag = str_replace('/blog/', '/', $tag);
echo $tag;
}
}
print $args['after_body'];
print $args['after_widget'];
if (function_exists('restore_current_blog')) {
restore_current_blog();
}
}
开发者ID:CoordCulturaDigital-Minc,项目名称:cdigital2014,代码行数:41,代码来源:widget-global-tags.php
示例16: widget
public function widget($args, $instance)
{
$cache = wp_cache_get('widget_custom_post_type_tag_cloud', '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 = apply_filters('widget_title', empty($instance['title']) ? __('Tags', 'custom-post-type-widgets') : $instance['title'], $instance, $this->id_base);
$taxonomy = $instance['taxonomy'];
echo $args['before_widget'];
if ($title) {
echo $args['before_title'] . $title . $args['after_title'];
}
echo '<div class="tagcloud">';
wp_tag_cloud(apply_filters('widget_tag_cloud_args', array('taxonomy' => $taxonomy)));
echo '</div>';
echo $args['after_widget'];
}
开发者ID:AryvartPhpTeam,项目名称:aryvartnew,代码行数:25,代码来源:widget-custom-post-type-tag-cloud.php
示例17: widget_om_tags
function widget_om_tags()
{
?>
<li id="tagCloud"><h2>Tag Cloud</h2><div class="pad"><?php
wp_tag_cloud('smallest=8&largest=18&number=20');
?>
</div></li>
<?php
}
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:9,代码来源:functions.php
示例18: widget
function widget($args, $instance)
{
?>
<div class="widget" id="tabbed-widget">
<div class="widget-container">
<div class="widget-top">
<ul class="tabs posts-taps">
<li class="tabs"><a href="#tab1"><?php
_e('Popular', 'tie');
?>
</a></li>
<li class="tabs"><a href="#tab2"><?php
_e('Recent', 'tie');
?>
</a></li>
<li class="tabs"><a href="#tab3"><?php
_e('Comments', 'tie');
?>
</a></li>
<li class="tabs" style="margin-left:0"><a href="#tab4"><?php
_e('Tags', 'tie');
?>
</a></li>
</ul>
</div>
<div id="tab1" class="tabs-wrap">
<ul>
<?php
tie_popular_posts();
?>
</ul>
</div>
<div id="tab2" class="tabs-wrap">
<ul>
<?php
tie_last_posts();
?>
</ul>
</div>
<div id="tab3" class="tabs-wrap">
<ul>
<?php
tie_most_commented();
?>
</ul>
</div>
<div id="tab4" class="tabs-wrap tagcloud">
<?php
wp_tag_cloud($args = array('largest' => 8, 'number' => 25, 'orderby' => 'count', 'order' => 'DESC'));
?>
</div>
</div>
</div><!-- .widget /-->
<?php
}
开发者ID:proj-2014,项目名称:vlan247-test-wp,代码行数:57,代码来源:widget-tabbed.php
示例19: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$socials = apply_filters('mars_social_profile_link', null);
$tag_cloud = array('smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 20, 'format' => 'flat', 'separator' => ' ', 'orderby' => 'name', 'order' => 'ASC', 'exclude' => null, 'include' => null, 'link' => 'view', 'taxonomy' => array('post_tag', 'video_tag'), 'echo' => false);
print $before_widget;
print $before_title . $title . $after_title;
print wp_tag_cloud($tag_cloud);
print $after_widget;
}
开发者ID:chypriote,项目名称:wp-video,代码行数:11,代码来源:Mars_KeyCloud_Widgets.php
示例20: results
function results($instance)
{
$instance["echo"] = false;
$args = array();
foreach ($instance as $name => $value) {
if ($name != "title" && $name != "display_css") {
$args[] = $name . "=" . $value;
}
}
return wp_tag_cloud(join("&", $args));
}
开发者ID:JunnLearning,项目名称:dk,代码行数:11,代码来源:gdtt-terms-cloud.php
注:本文中的wp_tag_cloud函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论