SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wordpress Code Help For Tag Search Results?

    Hey guys,

    I have a small problem that, for some reason, I can't find the solution to.

    When you search a keyword in my search bar, the results are what I expect, with the tags, category, etc. under the post excerpt on the search results page (that I edited in search.php).

    However, if you click a tag keyword (from tag cloud), the excerpt appears fine on the results page, but the bottom info as mentioned above does not appear.

    How can I get it to look exact as search bar results?

    Examples:
    Searched "coffee" in the search bar produces this result (which is good)
    http://suitej.com/?s=coffee&x=21&y=16

    Now when I click the coffee "tag", I don't get the bottom info under the post's excerpt:
    http://suitej.com/tag/coffee/

    I appreciate any help
    Thanks,
    Jay

  2. #2
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's because the search results are controlled by search.php whereas tag results are controlled by another file (archive.php I think). To change it, you will need to alter the other file to match the HTML output of the search.php.

    If it is archive.php as I suspect, then this will also change the look of your categories etc., so if you don't want that happening then you'll need to setup some sort of conditional statement to send different HTML depending on whether it is a tag page or category page.

  3. #3
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey Ryan,

    Thanks! It was in archive.php. It didn't occur to me to look there for some reason. lol.

    It did also change the archive results, but I'm ok with that.

    Out of curiosity, do you know a quick solution (code) to create a conditional statement to only have it appear on tag results and not archives? I can usually get around customizing existing code, but I'd be lost creating that on my own.

    Thanks again for the help and quick response!
    Jay

  4. #4
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Code PHP:
    <?php if ( is_tag() ) { ?>
    your code here
    <?php } ?>
    http://codex.wordpress.org/Conditional_Tags#A_Tag_Page

    Or you can create tag.php and more specifically tag-slug.php, slug being the tag title.

    Hope it helps.

  5. #5
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by suitej View Post
    Out of curiosity, do you know a quick solution (code) to create a conditional statement to only have it appear on tag results and not archives?
    Yep, the following should do the trick. Post back if you have any troubles.

    Code PHP:
    <?php 
      if (is_tag()) {
        echo 'This is a tag page';
      }
    ?>

  6. #6
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tested it quickly and it worked like a charm. Thanks so much guys!

    Jay


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •