RATE CARD!Pasang banner disini, dapatkan diskon 50%!

Kode WP Tag Cloud pada Theme WordPress

Kode WP Tag Cloud pada Theme WordPress

Kebeneran banget nih waktu lagi “ganti baju website ini” ada seorang blogger yang bertanya tentang kode Tag cloud untuk  dipasang di template wordpressnya (kalo di widget kan udah ada tuh ya, tinggal drag aja), nah barangkali aja nih ada sahabat Blogger yang lagi muter2 butuh juga, aku sharing deh ini kode2nya, semoga membantu:

kode Yang paling simple:

<?php wp_tag_cloud( $args ); ?> 

Nah kalo yang ini buat nampilin tag cloud yang paling populer hurufnya paling gede.contohnya seperti yang ada di sidebar potter.web.id saya ini:

<?php if ( function_exists('wp_tag_cloud') ) : ?>
<li>
<h2>Popular Tags</h2>
<ul>
<?php wp_tag_cloud('smallest=8&largest=22'); ?>
</ul>
</li>
<?php endif; ?>

Kalau yang ini untuk membatasi/ limit jumlah tag yang mau ditampilkan biar tidak terlalu banyak…ini cocok buat blog kamu yang kebanyakan tagnya biar gak berat dan ngacauin design donk:

<?php wp_tag_cloud('smallest=15&largest=40&number=50&orderby=count'); ?>

Naah kalo yang ini buat nampilin kategori dan tag sekaligus:

<?php 
  $args = array(
    'taxonomy'  => array('post_tag','category'), 
   ); 
   
  wp_tag_cloud($args);
?>

Pasang kode – kode diatas di Editor theme kamu yang ada di halaman Admin (tapi kalau buat sahabat blogger tidak begitu paham sebaiknya minta tolong saja kepada yang lebih ahli) karena takutnya terjadi error ada yang kehapus, dlsb).

Parameter Default Usagenya sbb:

 <?php $args = array(
    'smallest'                  => 8, 
    'largest'                   => 22,
    'unit'                      => 'pt', 
    'number'                    => 45,  
    'format'                    => 'flat',
    'separator'                 => "n",
    'orderby'                   => 'name', 
    'order'                     => 'ASC',
    'exclude'                   => null, 
    'include'                   => null, 
    'topic_count_text_callback' => default_topic_count_text,
    'link'                      => 'view', 
    'taxonomy'                  => 'post_tag', 
    'echo'                      => true ); ?>
  • smallest – The smallest tag (lowest count) is shown at size 8
  • largest – The largest tag (highest count) is shown at size 22
  • unit – Describes ‘pt’ (point) as the font-size unit for the smallest and largest values
  • number – Displays at most 45 tags
  • format – Displays the tags in flat (separated by whitespace) style
  • separator – Displays whitespace between tags
  • orderby – Order the tags by name
  • order – Sort the tags in ASCENDING fashion
  • exclude – Exclude no tags
  • include – Include all tags
  • topic_count_text_callback – Uses function default_topic_count_text
  • link – view
  • taxonomy – Use post tags for basis of cloud
  • echo – echo the results
    Sebagai catatan: wp_tag_cloud() itu berlokasi di wp-includes/category-template.php.

Post by: Lilis Mayasari/ www.liezmaya.web.id semoga membantu memberikan pencerahan ya buat yang lagi pusing ^^

Source: codex.wordpress.org

pasang banner premium
One Comment

Leave a Reply to sabun beras thailand Cancel reply

Your email address will not be published. Required fields are marked *

Please komentar yang nyambung yaaa dengan topik postingan saya diatas!, jangan spam! Ayo buktikan kalau anda adalah manusia! * Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.