I have a slick slider scroller on my home page that cycles through some of the pages I have on my main menu. I am using the following code to do this:
<div class="page-scroller" >
<div class="latest-page-ticker">
<h5>Scroller title</h5>
<div class="slick-slider">
<?php
global $post;
$child_pages_query_args = array(
'post_type' => 'page',
'post_parent' => 17,
'orderby'=> 'title',
'order' => 'ASC'
);
$child_pages = new WP_Query( $child_pages_query_args );
while ( $child_pages->have_posts() ) : $child_pages->the_post();
?>
<div class="slide">
<a class="entry-thumb-wrapper" href="<?php the_permalink(); ?>">
<div class="entry-thumb">
<div class="entry-category">
<?php echo get_the_category_list(); ?>
</div>
<div class="thumb-wrapper">
<?php the_post_thumbnail( 'post-small-rectangle-pin' );?>
</div>
</div>
</a>
<div class="entry-details">
<h4 class="entry-title">
<a href="<?php the_permalink(); ?>">
<?php echo the_title(); ?>
</a>
</h4>
<p>
<?php echo side_pages_get_excerpt(); ?>
</p>
</div>
<div class="clearfix"></div>
</div><!--/ .slide-->
<?php endwhile; ?>
<!--/carousel-inner-->
</div>
</div>
</div>
At the moment this scroller cycles through the child pages of the page with the ID 17, which is my first menu item and its children are on this first menu item dropdown menu. How can I have this so that it cycles through all my menu items and not only the child pages of the page with the ID 17, my first menu item? I would like it to cycle through all my menu items in the same way. After cycling through this first item and dropdown menu items it would go to the next item and its child pages(as dropdown items here). Would this be possible to achieve?
$parent
and set this to the parent ID for each menu item at the start of the loop.$parentids
with an array of IDs and then loop withforeach ($parentids as $parent) {
(existing code)}
so that$parent
would be a single ID, but @wunch 's answer is more direct way of doing this.