WordPress query

If you want to loop through WPC completable pages using a WordPress query, you can. You just need to apply the filter of `wpcomplete_list_pages` to your query, like so:

<?php
// get an array of the wpc_list_pages in php so you can loop through them yourself.
// uses the same attributes as the shortcode.
// example of creating your own nav from completable pages:
$pages = apply_filters('wpcomplete_list_pages', array());
echo '<ul>';
foreach ( $pages as $page ) {
echo '<li><a href="' . esc_url( get_permalink( $page ) ) . '">' . $page->post_title . '</a></li>';
}
echo '</ul>';
?>

You can edit this as needed to format or echo content however you’d like. Note that we do not offer support on PHP programming or queries.

Return to Support Articles