• Resolved jalacom

    (@jalacom)


    Hi,
    I have a tag list in my sidebar generated by this code:

    <ul class="sbtags">
    <?php
    $tags = get_tags( array('orderby' => 'count', 'order' => 'DESC', 'number'=>20)  );
    foreach ( (array) $tags as $tag ) {
    echo '<li><a href="' . get_tag_link ($tag->term_id) . '" rel="tag">' . $tag->name . '<span>(' . $tag->count . ')</span> </a></li>';}
    ?>
    </ul>

    displays just what I want…but when i click on one of the tags the results that are generated don’t seem to be contained to just “vegan” or “cookbook” or which ever tag I select. Any ideas on what I’m doing wrong? Have I provided enough information?
    Here’s the link to the site: GTSB

    Thanks so much for any help provided!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Michael

    (@alchymyth)

    what is the code in your theme’s tag.php ?

    if the theme does not have tag.php, what is the code of archive.php ?

    (please use the pastebin – see http://codex.wordpress.org/Forum_Welcome#Posting_Code )

    the clicked tag links results come up with this:
    Search Tag: Recipe

    Thread Starter jalacom

    (@jalacom)

    Hi alychymyth,
    I created a tag.php file. The code is pretty much the same as my index.php. Perhaps I’m not asking it to pull the right content?
    Here’s the first section of tag.php up until the opening of the loop:
    tag.php

    Michael

    (@alchymyth)

    no need to create a custom query – the tag.php will automatically use tag results with the normal loop;
    see for instance the code of archive.php –

    i.e. this line does not help and gives you the wrong results:

    <?php $my_query = "showposts=5&cat=4"; $my_query = new WP_Query($my_query); ?><!-- Calls the main blogroll category -->

    why are you calling the category?

    Thread Starter jalacom

    (@jalacom)

    Alchymyth,
    Category 4 is what I am using for the main content of the blog. Category 5 is used on the page Brilliant as a “subblog”. Not my favorite set up but this is what the client wanted so they could have two separate topics. Like i mentioned before the code I placed in tag.php is pretty much the same code as that from my main index.php. I wasn’t sure what I needed to alter between the two.
    So I should change tag.php to the normal loop and it will return posts with only the tag clicked? I’ll give that a shot.
    Thanks for your help. I’m still very new to this.

    Thread Starter jalacom

    (@jalacom)

    Yup looks like that’s doing the trick.
    Thanks again for your help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Tag list not linking to list of tags’ is closed to new replies.