Skip to content

Instantly share code, notes, and snippets.

@agustibr
Created November 11, 2012 16:59
Show Gist options
  • Save agustibr/4055505 to your computer and use it in GitHub Desktop.
Save agustibr/4055505 to your computer and use it in GitHub Desktop.
acat - wp widget with all tags
<?php
/**
* Plugin Name: a.Cat [NODE] myCustomCloud
* Plugin URI: http://agusti.cat
* Description: widget nuvol d'etiquetes custom
* Author: Agusti
* Author URI: http://agusti.cat
* Version: 0.2.0
*/
/* Place custom code below this line. */
function widget_myCustomCloud($args) {
extract($args);
?>
<?php echo $before_widget; ?>
<?php echo $before_title
. 'Etiquetes:'
. $after_title; ?>
<?php
$args_cloud = array(
'smallest' => 8,
'largest' => 18,
'unit' => 'pt',
'number' => 0,
'format' => 'array',
'orderby' => 'name', //'count',
'order' => 'ASC', //'DESC',
'exclude' => null,
'include' => null,
//'topic_count_text_callback' => default_topic_count_text,
'link' => 'view',
'taxonomy' => 'post_tag',
'echo' => false ); ?>
<ul class="nav nav-pills">
<?php
$my_tags = wp_tag_cloud($args_cloud);
foreach ($my_tags as $my_tag) echo '<li>'.$my_tag.'</li>';
?>
</ul>
<?php echo $after_widget; ?>
<?php
}
//wp_register_sidebar_widget('myCustomCloud', 'widget_myCustomCloud');
wp_register_sidebar_widget(
'myCustomCloud_1', // your unique widget id
'myCustomCloud', // widget name
'widget_myCustomCloud', // callback function
array( // options
'description' => 'display all tags!'
)
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment