Changing tag cloud widget using functions.php
-
I’m trying to use the
functions.php
file to alter the tag cloud widget of a theme I’m creating. I’ve managed to create a new widget, called “tag cloud”, however, this is coexisting alongside the default widget, instead of replacing it.The following code is the content of my
functions.php
file:<?php if ( function_exists('register_sidebars') ) register_sidebars(3); function widget_merdekareloaded_tags() { ?> <li id="tag_list" class="widget tag_list"> <h2>Popular tags</h2> <?php $tags = get_tags(array( 'orderby' => 'count', 'order' => 'DESC', 'number' => 30, ) ); echo '<ul> '; foreach ($tags as $tag) { echo '<li><a href="' . get_tag_link($tag->term_id) . '" rel="tag">' . $tag->name . '</a> (' . $tag->count . ')</li> '; } echo '</ul>'; ?></li> <?php } if ( function_exists('register_sidebar_widget') ) register_sidebar_widget(__('Tag cloud'), 'widget_merdekareloaded_tags'); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Changing tag cloud widget using functions.php’ is closed to new replies.