Using WP_Query to display popular pages
I’m trying to display popular pages (of a parent) in a sidebar based on page views — like popular posts, but for pages.
I’ve tried the following code – which does list pages – but it’s not listing child pages of page ID 3.
<?php $popular = new WP_Query('static=true &post_type=page &get_children=3 &post_status=publish &orderby=ASC &posts_per_page=5'); ?> <h5>Popular Pages</h5> <ul> <?php while ($popular->have_posts()) : $popular->the_post(); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; ?> </ul>
I’ve also tried using
Any suggestions would be greatly appreciated.
- The topic ‘Using WP_Query to display popular pages’ is closed to new replies.