0

I'm developing a a site using the wp e-commerce plugin, and it handles tags in pretty much the same way it would if I were using it for a blog instead of a store.

The issue is that I want to use the tags as a secondary kind of navigation menu so that customers can view all items made from a certain material no matter what product category the item is in.

My issue is that the theme-functions page within wp e-commerce is causing certain tags to be in huge fonts as these tags are related to more products. What I want to do is be able to display each of the tags as links within <ul> <li> with each tag using the same sized font.

I understand some basics of php, but not enough to fully decode the theme functions file and edit it. I have considered waiting until I've got all of the products into the system then handcoding the list of tags, but then if my client wants to add more tags in the future they obviously won't be included.

If anyone has any insights or ideas Id be very greatful. I would post the code in question here but its about 200 lines long - but if it's needed in order to find the solution pls tell me so that I can add it.

1

2 Answers 2

1

you can use wp_list_categories() to output an unordered list:

<?php
wp_list_categories( array('taxonomy' => 'product_tag') );
?>
1
  • Thank you Milo - do you know which file I should put this into? Should I just hardcode this into the sidebar? the product tag widget file is still somewhat baffling to my N00B brain Commented May 5, 2011 at 2:53
2

I use this for tag display on an archive page. its a ul, with each tag in an li. You'll see that 21 in the code. That is for only displaying tags with more than 21 posts assigned. You can change that number as you like.... If you have a lot of tags, it helps keep the riff raff out

                <h6><?php _e( 'Popular Tags', 'voodoo_lion' ); ?></h6>
                <ul>
                    <?php
                    $tags = get_tags();
                    foreach ($tags as $tag){
                        if ($tag->count < 21) continue;
                        $tag_link = get_tag_link($tag->term_id);
                        $html .= "<li><a href='{$tag_link}/' title='{$tag->name} Tag' >{$tag->name}</a>($tag->count)</li>";
                    }
                    echo $html;
                    ?>
                </ul>
8
  • 1
    @Rev. Voodoo - shouldn't it be foreach($tags as $tag){...? ;)
    – kaiser
    Commented May 3, 2011 at 20:04
  • 1
    know what? it probably should! I must have screwed that up ages ago! It works as is, but yeah, you are corret! Commented May 3, 2011 at 20:16
  • I use essentially the same thing as the Right Rev. Voodoo. Commented May 3, 2011 at 20:26
  • If Screaming Violet is referring to the tags assigned to products created with the wp e-commerce plugin, the taxonomy is 'product_tags', they're not the default WordPress tags.
    – Milo
    Commented May 3, 2011 at 21:17
  • @Rev. Voodoo - Other sidenote: it's normally faster if you first save something into a variable and then compare it, instead of the accessing the index on comparisson. Ex.: $term_id = $tag->term_id; $tag_link = get_tag_link(... should be faster. Also '<li><a href="'.$tag_link... is much faster as you avoid asking what <li> is.
    – kaiser
    Commented May 3, 2011 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.