Looping SUB-pages, not all pages
-
Hi!
I am using WordPress on my portfolio. I have a section based on pages this features the projects I am working on.
I want to make a project-frontpage, where I have a list af all my projects (this I can do!) and then below I want to show four random projects. I can make it get four random pages, however I don’t want to fetch all pages (like about, contact, etc..)
I just want the subpages of the “projects”-pageBut it won’t work. This is what I have:
<?php $args=array( 'showposts'=>4, 'child_of' => 57, 'post_type' => 'page', 'caller_get_posts'=>1, 'orderby' => 'rand', ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); $i++; ?> <div class="minorproject" <?php if($i==4) { echo 'style="margin-left: 37px;"';} ?>> <div class="entryimage"> <?php custom_field_image(); ?></div> <div id="titletitle"><h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1> <div class="date"><?php the_time('M jS, Y') ?> </div> </div></div> <?php endwhile; } ?></div> <?php endwhile; endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Looping SUB-pages, not all pages’ is closed to new replies.