Advertisement
tolikpunkoff

tags-cloud-shortcode-wp

Jan 20th, 2017
520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. function taglist_shortcode($atts)
  2. {
  3.     extract(shortcode_atts(array(
  4.               'type' => '',          
  5.         ), $atts));
  6.     $ret="";
  7.    
  8.     if ($type=='topic')
  9.     {      
  10.         $args=array (
  11.             'smallest' => '15',
  12.             'largest' => '22',
  13.             'number' => '0',
  14.             'format' => 'list',
  15.             'echo' => '0',
  16.             'taxonomy'  => array('category'),
  17.             );
  18.         $ret=wp_tag_cloud($args);
  19.     }
  20.     else
  21.     {
  22.         $args=array (
  23.             'smallest' => '8',
  24.             'largest' => '22',
  25.             'number' => '0',
  26.             'format' => 'list',
  27.             'echo' => '0',
  28.             'taxonomy'  => array('post_tag'),
  29.             );
  30.         $ret=wp_tag_cloud($args);
  31.     }
  32.     return $ret;
  33. }
  34. add_shortcode ('taglist','taglist_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement