Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adjust Size of Hot Tags


  • thomasw98
    Member

    @thomasw98

    How do I adjust the font size of the hot tags displayed on the first page (not the hot tags heading, but the actual tag names themselves)?

Viewing 21 replies - 1 through 21 (of 21 total)
  • You have to edit ‘template-functions.php’ which is located in the bb-includes folder. The function is at line 890, called tag_heat_map. You will see that it takes 4 variables as parameters the first one is the smallest size possible for the tags, the second one is the largest size possible for the tags, the third is wether it the font size is measured in points(pt), pixels(px), or ems(em). The default is pt. The last parameter is the maximum numbers of tags that are displayed.

    Hope this helps!


    thomasw98
    Member

    @thomasw98

    omg…i spent 3 hours trying to find that. Thanks loads!

    There is no need to edit any core files.

    Copy bb-template/front-page.php to my-templates/front-page.php and then in that file find

    <?php tag_heat_map(); ?>

    and replace it with:

    <?php tag_heat_map( 10, 30, 'px', 40); ?>

    to generate a tag cloud of the top 40 tags where the smallest tag displays with a 10px font-size and the largest with a 30px font-size.

    The first parameter is the size of the smallest tag, the second is the size of the largest tag, the third is what unit to use (‘em’, ‘px’, ‘pt’, …) and the last is how many tags to show.

    <?php tag_heat_map( 60, 150, '%', 40); ?>

    Yay, percentages work too! It’s not 8am yet and that’s made my day.


    rimianperkins
    Member

    @rimianperkins

    you need to get something to help you find things like Grep. :)


    weirdtherapy
    Member

    @weirdtherapy

    thx for this thread – i have been searching too :)

    i don’t know if it might be useful but i don’t know why that happend so i just post it here:

    it now works with this code:

    <?php tag_heat_map( 10, 20, ‘px’, 20); ?>

    but before tried the same with:

    <?php tag_heat_map( 10, 26, ‘px’, 20); ?>

    same line – only one number different – and it showed 26px as minimum and one of the bigger ones had 42px size

    anyone knows why?

    I don’t know much about php and i can’t imagine how this could be a bug – but i don’t know how this can happen either

    What does this mean?

    Warning: Division by zero in /xxxx/xxxx/xxxx/xxxx/bb-includes/template-functions.php on line 1195

    Warning: Division by zero in /xxxx/xxxx/xxxx/xxxx/bb-includes/template-functions.php on line 1202

    I played around with changing

    <?php tag_heat_map( 10, 30, ‘px’, 40); ?>

    to

    <?php tag_heat_map( 10, 10, ‘px’, 40); ?>

    You want all the tags the same size? That is what the second code you have means. I guess it doesn’t like having tags all the same size. For reference, check out:

    http://bbpress.org/forums/topic/67?replies=5#post-295

    Trent

    Thanks Trent- I just wanted to adjust the size of the largest display, then decided to see what it would look like with tags the same size – just helps to know what was happening.

    Rae

    There is an error in /bb-includes/template-functions.php file .

    In that file find

    ($smallest + ($count/$fontstep)."$unit;'>$tag n";

    and replace it with:

    ($smallest + (($count-min($counts))/$fontstep))."$unit;'>$tag n";

    That bug and some of these oddities should be fixed in the upcoming bbPress 0.80.

    Thanks!

    Not at all! :)


    DrTech
    Participant

    @drtech

    My hot tags only use the first, third and forth parameter. It only shows one size font. Any ideas on why the second parameter does not work.

    http://koma-inu.org/bbpress/

    Currently, you only have 1 topic for each of those tags. Therefore, the system is weighing them all the same and that is why they are all the same size. Once you have more tags and more than 1 topic in each tag, it will change size for you. It might even take 3 or 4 topics (or more) in a tag before you really notice the difference.

    Trent

    I tried changing the Tag Clouds values on my forum with

    <?php tag_heat_map( 10, 30, ‘px’, 40); ?>

    The first three attributes work as expected, however the last setting (40) which should influence how many Tags are displayed doesn’t change a thing no matter if I set it to 1 or 100.

    I’m on Alpha 2 and latest WP.


    _ck_
    Participant

    @_ck_

    Try passing it as an array to get around the bug:

    <?php tag_heat_map(array( 'smallest' => 10, 'largest' => 30, 'unit' => 'px', 'limit' => 40 )); ?>

    Unfortunately it’s still broken.

    But if it’s indeed a known bug with Alpha 2 (as you suggested) I’m in no hurry to fix it.


    _ck_
    Participant

    @_ck_

    Technically tag_heat_map has been depricated in 1.0a2 and should use bb_tag_heat_map instead but I believe the problem would persist since a wrapper is used.

    Try one last shot with this:

    <?php bb_tag_heat_map(array( 'smallest' => 10, 'largest' => 30, 'unit' => 'px', 'limit' => 40 )); ?>

    That is interesting to know, thanks for the clarification.

    And, yes, you’re right, it still doesn’t work at this point because of the wrapper.


    NikonRumors
    Member

    @nikonrumorsadmin

    Is this fixed in 0.9.0.4? Has anyone found a way around it?

    Thanks.


    gadgets
    Member

    @gadgets

    Thanks for this post.I try about 2 hour.And now finish.

    Thanks again.

    Dean

Viewing 21 replies - 1 through 21 (of 21 total)

You must be logged in to reply to this topic.