Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

yboss on "Embed Category Search Into Page Loop issues"

$
0
0

Greetings WP community,
I've been playing with WP for a while now and I'm trying to create an 'events' page that will post wordpress posts from 'cat=4' or the events category. It is posting fine except for the issue that it is looping the posts over and over again infinitely. Is there a way I can loop this so it shows all category posts but doesn't repeat them? Thanks for all the help everyone!
-Yuval

<?php if (have_posts()) :  ?>
                    <?php while (have_posts()) : the_post(); ?>

                        <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix post'); ?> role="article">

                            <header>
                                <h2 class="line"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
                            </header> <!-- end article header -->

                            <section class="post_content clearfix" itemprop="articleBody">
                              <?php
query_posts('cat=8');
while (have_posts()) : the_post();
the_excerpt();
endwhile;
?>

Viewing all articles
Browse latest Browse all 8245

Trending Articles