Support » Themes and Templates » Category post query problem

  • Resolved CHEWX


    Okay, my main page is posts from all my categories but 1, then I have a separate page that posts everything from the category that isn’t on the main page.

    My code in the page is this:

    <?php query_posts('cat=341&showposts=6'); ?>
    		<?php if (have_posts()) : ?>
    			<?php while (have_posts()) : the_post(); ?>
                    <article id="article-inspir" class="drop-shadow curved curved-hz-1">   
                        <header class="inspir-header">
                            <div class="inspir-title">
                                <h1><?php the_title(); ?></h1>
                            </div> <!--inspir-title-->
                            <div class="inspir-date">
                                <?php the_time('j F, y') ?>
                            </div> <!--inspir-date-->
                        <div style="clear: both;"></div>
                        </header> <!--inspir-header-->	
                        <footer class="inspir-footer">
                            <div class="inspir-cat">
                                <?php the_author(); ?> 
                            </div> <!--inspir-cat-->
                            <div class="inspir-tags">
                                <p><?php the_excerpt(); ?></p>
                            </div> <!--inspir-tags-->
                            <div class="inspir-comments">
                                <a href="">comments(0)</a>
                        <div style="clear: both;"></div>
                        </footer> <!--inspir-footer-->
                    </article> <!--article-inspir-->
    <?php endwhile; endif; ?>

    I have 2 posts in that article and it’s posting them in the right parts and then after the </article> tag, it’s posting the full post. No title or anything, just the full post.


Viewing 7 replies - 1 through 7 (of 7 total)
  • Digest WP



    Other issues could be causing it besides a duplicate loop. Can you send link to site?

    I’d also like to see a link to this site… I’m new here and this is pretty confusing…

    Would like to know what the outcome is…

    The site’s a re-design so I’m creating it locally.

    Hang on, theirs a problem with page.php.

    I’ll show the page.php and you should be able to find the solution, I know I can’t but it’s something to do with the page.php loop I suspect.

    Heres page.php

    <?php get_header(); ?>
    <?php get_sidebar(); ?>
    <!-- INDEX START -->
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    				<?php the_content(); ?>
    			<?php endwhile; else: ?>
    			<?php endif; ?>        
                <div style="clear: both;"></div>
                </section> <!--main-->
                <aside id="page">
                </aside> <!--page-->
    </div> <!-- wrapper -->
    <div id="page-change">
        <div class="outer-pad">
        	<div class="inner">
                <div class="page-old">
                    <?php next_posts_link('older') ?>
                <div class="page-new">
                    <?php previous_posts_link('newer') ?>
    <!-- INDEX END -->
    <?php get_footer(); ?>
    Digest WP


    This is a basic loop.

    <?php if (have_posts()) : ?>
                   <?php while (have_posts()) : the_post(); ?>
                   <!-- do stuff ... -->
                   <?php endwhile; ?>
    <?php endif; ?>

    You have stuff out side the loop that should be in it.

    This page should help

    I’ve read through that, am I doing a multiple loop or a nested loop.

    In theory it would be nested, but I don’t know how to do this loop over two pages.


    and the actual page on the wordpress dashboard.

    Simple fix, thanks guys :S

    I forgot to reset the loop.

    <?php wp_reset_query(); ?>
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Category post query problem’ is closed to new replies.