WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: NextGEN Gallery] tag cloud in sidebar used as navigation (4 posts)

  1. mtingle
    Member
    Posted 4 years ago #

    Here is a solution to the problem of how to get a tag cloud listed in your sidebar to act as navigation.

    So you want a tag cloud to appear in the side bar, and when you click on a tag the corresponding pictures to appear in the main page area?

    here is how I did it (amended from zyrq updated for wordpress 3.0 and nextgen 1.5.5 - it may work with earlier versions of both):

    1. create a page called 'gallery' and add this code (use the html not the visual editor) '[tagcloud]'

    2. download this plugin "Samsarin PHP Widget" and install it.

    3. paste this code into the new "Samsarian PHP 1" widget created:

    <ul class="galtags">
    <?php
    
    global $wpdb;
    $results = $wpdb->get_results('SELECT * FROM wp_terms INNER JOIN wp_term_taxonomy ON wp_terms.term_id = wp_term_taxonomy.term_taxonomy_id WHERE taxonomy = "ngg_tag"');
    foreach ($results as $row) {
    echo "<li><a href=http://www.example.com/gallery/?gallerytag=";
    echo $row->slug;
    echo ">";
    echo $row->name;
    echo "</a> </li> ";
    }
    
    ?>
    </ul>

    4. change http://www.example.com to the name of your website URL.

    5. Thats it.

    For some reason every other attempt on the web to solve this problem does not work so after I got it working I thought I'd share this to help others who may have got stuck

    Michael

  2. mtingle
    Member
    Posted 4 years ago #

    If anyone happens to know how to change the tag list order in the sidebar I'd be interested to know.

    I think I'd prefer it to be in alphabetical order, or at least have some options. At the moment its output in the order they went into the database.

  3. mr_swede
    Member
    Posted 3 years ago #

    mtingle,

    this is how I managed to sort the tags in alphabetical order by tag name.

    <ul class="galtags">
    <?php
    
    global $wpdb;
    $results = $wpdb->get_results('SELECT name,slug FROM wp_terms INNER JOIN wp_term_taxonomy ON wp_terms.term_id = wp_term_taxonomy.term_taxonomy_id WHERE taxonomy = "ngg_tag" ORDER BY name ASC');
    foreach ($results as $row) {
    echo "<a href=../wp-content/nggallery/tags/?gallerytag=";
    echo $row->slug;
    echo ">";
    echo $row->name;
    echo "</a> ";
    }
    ?>
    </ul>

    The two unsolved issues that remain for me is to get a "real" tag cloud with tag sizes according to the number of pictures with a particular tag. Now all tags are the same font size.

    I also want to have separate tag clouds for different kinds of pictures; my own, picture restaurations and misc pictures.
    I use the plugin "NGG Custom Fields" that enables custom fields for galleries/pictures. But how do I use that to separate the tag clouds?

  4. ruebenad
    Member
    Posted 3 years ago #

    Hi

    the shortcode [tagcloud] seems to work well on my page categories but the the database the widget is looking up seems mixed/confused.

    http://www.swanowl.com

    How can I get the widget to look at the ngg tag database that the [tagcloud] is?

    I'm a newbie to all this :)

Topic Closed

This topic has been closed to new replies.

About this Topic