• Hi!

    I’m showing 8 latest posts from category called “arvostelut” (reviews, in english) on top of my site (I mean top of every page). It works great, but when i want to see one full-story in single.php it shows me all the eight reviews besides the one I would like to see.

    So kinda the php query continues to the content even though I would not want that.

    Here’s the code i use to show the 8 latest reviews.

    <?php if (have_posts()) : ?>
    <?php query_posts('category_name=arvostelut&posts_per_page=8'); ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    		<div class="etusivu_arvostelu"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
    </a></div>
    
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    btw. it doesn’t matter whether I have this code in header.php or in index.php, single.php, archieve.php etc.

    Thank you very much for your help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • It works great, but when i want to see one full-story in single.php it shows me all the eight reviews besides the one I would like to see.

    This confused me. Can you explain further what is it you want (or don’t want). Thanks.

    Thread Starter pezpe

    (@pezpe)

    You know, I click one of those links (one of the eight reviews) so I could read that one, but besides the correct article it shows me eight articles (exactly the same ones I included on top of the site).

    So to be simple… I don’t have a chance to read any article right now.

    Thread Starter pezpe

    (@pezpe)

    Alright…. here’s two screenshots for you.

    So what I have done is: I have clicked the review called August Burns Red – Constellations.

    Here’s what it shows when I don’t have the php query -code which I posted on the very first post of this topic.
    SHOT 1 (as you can see, it gives me the full story of the article Augustu Burns Red. So this is the one which works correctly)

    But when I use the php query code to show the latest reviews on top of my site and when I try to read the same article (August Burns Red) it prints me this: SHOT 2. And after the article Eye For All it shows all the reviews which I have included on top of the page.

    So are you saying…

    When I look at the single post “Eye for All – Self Titled 7” I don’t want “Eye for All – Self Titled 7” to be included in the 8 posts showing in the header?

    If so then you should be able to use the ‘post__not_in’ => array($post->ID) argument with query_posts.

    Thread Starter pezpe

    (@pezpe)

    No no no.

    I want to see the article August Burns Red – Constellations (like I see in shot1).

    Thread Starter pezpe

    (@pezpe)

    You know the shot2 gives me wrong result in content div. It shouldn’t show Eye for all.

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

The topic ‘Problems with showing posts from specific category’ is closed to new replies.