WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Category post query problem (8 posts)

  1. CHEWX
    Member
    Posted 1 year ago #

    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><!--inspir-comments-->
    
                        <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.

    Thanks

  2. Digest WP
    Member
    Posted 1 year ago #

    Hello,

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

  3. tiaanswart
    Member
    Posted 1 year ago #

    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...

  4. CHEWX
    Member
    Posted 1 year ago #

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

  5. CHEWX
    Member
    Posted 1 year ago #

    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><!--inner-main-->
    
    	</div><!--outer-pad-->
    
    </div> <!-- wrapper -->
    
    <div id="page-change">
    
        <div class="outer-pad">
    
        	<div class="inner">
    
                <div class="page-old">
    
                    <?php next_posts_link('older') ?>
    
                </div>
    
                <div class="page-new">
    
                    <?php previous_posts_link('newer') ?>
    
                </div>
    
    <!-- INDEX END -->
    
    <?php get_footer(); ?>
  6. Digest WP
    Member
    Posted 1 year ago #

    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 http://codex.wordpress.org/The_Loop

  7. CHEWX
    Member
    Posted 1 year ago #

    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.

    page.php

    and the actual page on the wordpress dashboard.

  8. CHEWX
    Member
    Posted 1 year ago #

    Simple fix, thanks guys :S

    I forgot to reset the loop.

    <?php wp_reset_query(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic