Forums

show the tags in a list (8 posts)

  1. Mayur Somani
    Member
    Posted 11 months ago #

    Hi I want to show the tags as a list in the sidebar along with the number of posts that each tag is associated with like,

    tagname(71)

    Is there some plugin that does this.

  2. MichaelH
    moderator
    Posted 11 months ago #

    This might work for you:

    <?php
    $tags = get_tags( array('orderby' => 'count', 'order' => 'DESC') );
    foreach ( (array) $tags as $tag ) {
    echo '<a href="' . get_tag_link ($tag->term_id) . '" rel="tag">' . $tag->name . ' (' . $tag->count . ') </a>';
    }
    ?>
  3. MichaelH
    moderator
    Posted 11 months ago #

    Oops, found this plugin that might help also:
    http://wordpress.org/extend/plugins/list-tags/

  4. icarusgraeme
    Member
    Posted 6 months ago #

    I used the code shown above and it worked great.

    I'm trying to sort my tags by initial letter (all the A's under A, etc.).

    From the "get_tags" function page I think the "name_like" argument should pull this off, but for some reason, it's not working. This is what I have:

    <ul>
    <?php
    $tags = get_tags( array('name_like' => "a", 'order' => 'ASC') );
    foreach ( (array) $tags as $tag ) {
    echo '<li><a href="' . get_tag_link ($tag->term_id) . '" rel="tag">' . $tag->name . ' </a></li>';
    }
    ?>
    </ul>

    Any thoughts on what I'm doing wrong? Am I using the name_like argument wrong?

  5. doublejosh
    Member
    Posted 6 months ago #

    Thanks so much MichaelH!

  6. Vivek Shah
    Member
    Posted 5 months ago #

    How can i include or exclude particular tags in the list ?

  7. belogir
    Member
    Posted 4 months ago #

    hi michael
    i use :

    <?php list_tags(); ?>

    in my footer to show tags cloud
    but not working
    plz help me

  8. s872
    Member
    Posted 6 days ago #

    I am using the following code in my sidebar to show the list of tags with count for each.

    <?php
    $tags = get_tags( array('orderby' => 'count', 'order' => 'DESC') );
    foreach ( (array) $tags as $tag ) {
    echo '<li><a href="' . get_tag_link ($tag->term_id) . '" rel="tag">' . $tag->name . ' (' . $tag->count . ') </a></li>';
    }
    ?>

    Is there a way to have only the top (for example) 15 tags to show in this list with a link below the tags to a page where I will show all my tags in a specific format, e.g. cloud.

    Cheers,
    Simon.

Reply

You must log in to post.

About this Topic