• Hello,

    Im making a theme wich has last post on the left and 10 last post titles on the right.

    For the left side i used:

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : query_posts('showposts=1'); the_post(); ?>

    For the right:

    <?php query_posts("showposts=10&offset=1"); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    Its all in index.php

    The problem is when clicking on a tag it shows only 1 post related to that tag.
    Is there any way to show more then one tag, maybe with special page for tags?
    I used custom page for regular search and it works.
    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Well, that code is straight up wrong, for one thing…

    This should be the first bit:

    <?php
    query_posts('showposts=1');
    if (have_posts()) : while (have_posts()) : the_post();
    ... blah blah ...
    endwhile;
    endif;
    ?>

    query_posts should never be in a loop. Bad form.

    Secondly, you should include the query_string as well in your calls, otherwise you’ll lose information you’re looking for. Like so:

    query_posts( $query_string . '&showposts=1');
    And
    query_posts($query_string ."&showposts=10&offset=1");

    This will retain the existing query_string so that things like dates, categories, tags, etc, all continue to function correctly.

    Thread Starter entertainer

    (@entertainer)

    Thanks. 🙂
    And i also found Tag Archive template, so now i can show more then 1 related post.

    Just installed a brand new 3.2.3 with that new tag feature and the default theme and no plugins. What a good idea to implement tags, but they don’t play too well with Search, and this is why:

    Searching for tags in the search box only finds the posts which have that tag first in their tag list (I used commas to separate tags, right? And in any case if I click on the tags I get the expected result (all pages tagged with that tag, whereever the tags are in their respective tag lists)).

    so, this isn’t my code that isn’t working, it’s shipped code. Just to be clear!

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    The Search functionality does not search for tags at all.

    The search is a full text search, but it only looks in the post title and the post content. That’s it. No categories, no tags, nothing else.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Broken tag search’ is closed to new replies.