hello,
I’m trying to use a snippet I found on the wordpress.org forum (i’m unable to post the link as I am a new user but if you search for that snippet you’ll find it).
What I’m trying to do is display a list of tags in my sidebar, how many times they are used in posts, and make each link to an archive of those posts.
The snippet I’m using from the post listed above is this:
[php]<?php
// Select all the post tag IDs
$the_tags = $wpdb->get_col(“SELECT term_id
FROM $wpdb->term_taxonomy WHERE taxonomy = ‘post_tag’” );
// Loop over each ID, and grab associated data
foreach($the_tags as $tag_id) {
// Get information on the post tag
$post_tag = get_term( $tag_id, 'post_tag' );
// Print the tag name and count (how many posts have this tag)
echo $post_tag->name.' ( '.$post_tag->count.' ) ';
// Unset the data when it's not needed
unset($post_tag);
}
?>[/php]
This is how I’ve altered the echo post tag line so far. Obviously it’s not correct, I’m not sure if I have the right content and know that I’m not concatenating it correctly ( I know very little about PHP, so i’m trying my best):
[php]echo ‘
Any help would be appreciated. Thank you in advance.