WordPress.org

Forums

[resolved] Same text size in Tag Cloud (11 posts)

  1. YOTS
    Member
    Posted 6 years ago #

    I'm trying to get a list of all my tags to display in the same font size no matter how often a tag is being used. I set the smallest and largest parameters but the tags are still different sizes. Here is the code I used:

    <?php wp_tag_cloud('smallest=1&largest=0&unit=em&number=0&format=list'); ?>

    Anyone know how I can easily get all the tags to show the same size? Thanks.

  2. MichaelH
    Member
    Posted 6 years ago #

    You're not going to be able to do that with the Template Tag, wp_tag_cloud(), because if I'm reading the code correctly there is always a 'spread' between the font sizes. Look in the line 340 of wp-includes/category-template.php. So try this:

    <?php
    $tags = get_tags( array('orderby' => 'count', 'order' => 'DESC') );
    foreach ( (array) $tags as $tag ) {
    echo 'tag name '.$tag->name . 'tag count '. $tag->count;
    }
    ?>
  3. YOTS
    Member
    Posted 6 years ago #

    Michael thanks. That didn't seem to work. This is what it generated:

    tag name gridtag count 4tag name templatetag count 1tag name indesigntag count 1tag name tooltag count 1tag name filetag count 1tag name typographytag count 1tag name quotestag count 1tag name punctuationtag count 1

  4. MichaelH
    Member
    Posted 6 years ago #

    Yes that's the tag name and tag count for every tag. I'll leave it to you to style it accordingly.

  5. YOTS
    Member
    Posted 6 years ago #

    How would I style that it? Through CSS? I don't see any ids or classes.

  6. MichaelH
    Member
    Posted 6 years ago #

    Maybe you'll like this more better

    <?php
    $tags = get_tags( array('orderby' => 'count', 'order' => 'DESC') );
    foreach ( (array) $tags as $tag ) {
    ?>
    <div class="navigation">
    <?php echo '<a href="' . get_tag_link ($tag->term_id) . '" rel="tag">' . $tag->name . '</a>';	?>
    </div>
    <?php		}
    ?>
  7. YOTS
    Member
    Posted 6 years ago #

    Michael, you're a damn genius. That is perfect. Thanks so much for all the help. Very much appreciated.

  8. MichaelH
    Member
    Posted 6 years ago #

    Genius at stealing code from core ;)

    Thanks

  9. toppen56
    Member
    Posted 6 years ago #

    I want to do the same thing. Where do I make this change? I'm using the iNove theme.

  10. toppen56
    Member
    Posted 6 years ago #

    Ignore my question, I see you gave a file name in your original answer: wp-includes/category-template.php

  11. dassad
    Member
    Posted 6 years ago #

    Hey... this realy works. Check it out at my poker blog Realz thank you, untyl now looked crapy but now it's ok. Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic