Return to Snippet

Revision: 54728
at January 10, 2012 00:49 by i-am-andy


Initial Code
<?php $loop = new WP_Query( array( 'post_type' => 'products', 'post_parent' => 0, 'posts_per_page' => 30, 'order' => 'ASC' ) ); ?>
                                     
                                    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
                                    
                                        <div class="navigation">
                                           <div class="content">
                                              <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                                              <a href="<?php the_permalink() ?>" class="hotspot" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('product-thumbnail'); ?></a>
                                          	</div>
                                        </div>

<?php endwhile; ?>

Initial URL
http://stackoverflow.com/questions/8343544/query-only-parent-pages-in-custom-post-type-within-loop

Initial Description
Show only children posts of a parent custom post type, not all child posts

Initial Title
Show only children posts of a parent custom post type, not all child posts

Initial Tags
wordpress

Initial Language
PHP