• Resolved Joshua Goodwin

    (@joshuagoodwin)


    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)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Try this instead of your call to register_sidebar_widget:

    $widget_ops = array('classname' => 'widget_tag_cloud', 'description' => __( "Your most used tags in cloud format") );
    wp_register_sidebar_widget('tag_cloud', __('Tag Cloud'), 'widget_merdekareloaded_tags', $widget_ops);

    Thread Starter Joshua Goodwin

    (@joshuagoodwin)

    Thanks, Otto! It works a treat. I actually just found another way to get it working, but yours is better.

    Hello,
    Your most used tags in cloud format
    I am really glad you guys got that issue solved, I am still far away from understanding what this tag means, excepted that I’ve got a basic demo from the site : http://www.makecloud.com/ that substantially requires a valid rss URL and delivers back online, a script that is poppin’ a line of links. each one referring to every single link-url of the feed.rss passed in the online form.
    A demo of that is here : http://pr.c-php.com/wd/link.htm

    That is a very basic thing that doesn’t work with WordPress 2.7 which I have implemented on my server.

    I found a site online that is promising to fix a plugin for WordPress, but it requires My WordPress PassWord, sofar I do not trust anyone I opted to download their related software tagcloud_070311
    …that was a complete failure, as all paths were not found!

    Can any of you explain me what are the advantages to dig in these clouds?
    …does it make any good for SEO ? Even if indirectly, as a crawler might be set to put extra attention on those features.
    If all it does is to make a scrambled area linking to the rss resources, it seems to me to be not that interesting.

    Anyhow if any of you can spend some word in streaming my efforts to the final implementation of this (…related to WordPress or not) I would greatly appreciate that and insert it in my forum and in my WordPress BLOG with the benefit of the source rights.
    Thanks and wishing you all an Happy New Year
    Vittorio Ognissanti

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Changing tag cloud widget using functions.php’ is closed to new replies.