Limit Tags displayed
-
(I think I posted this is the wrong section of the forum…sorry)
Hi,
I have this code snippet for my tags. It displays them in a list as links along with the tag count.<?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 '<li><a href="'. get_tag_link($tag_id).'">'.$post_tag->name.'</a><span>('.$post_tag->count.')</span></li> '; // Unset the data when it's not needed unset($post_tag); } ?>
I have two questions.
1. How would I use this (i’ve altered it, it’s not my code) and change it to limit the amount of tags displayed to 15?2. I have some test tags set up and assigned to some test posts. When i click on a tag that has been used in my tag list will WP be looking for an archive.php file? Currently nothing happens when i click on one of my tags. I haven’t set up an archive.php file yet so I’m assuming that’s the issue but wanted to double check.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Limit Tags displayed’ is closed to new replies.