WordPress Query
WPComplete allows site owners to build flexible navigation experiences by tapping into completable pages programmatically. For those comfortable working with PHP, it’s possible to loop through these pages using a standard WordPress query and a WPComplete filter. This is especially useful for creating custom menus, sidebars, or progress-based content displays.
Example: Loop Through Completable Pages
To retrieve a list of WPComplete completable pages, apply the wpcomplete_list_pages filter in a custom query:
<?php
// Get an array of the wpc_list_pages in PHP so you can loop through them yourself.
// This uses the same attributes as the shortcode.
// Example of creating your own navigation 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>';
?>
This code outputs a list of completable pages, with each one linked by title. The format and output can be customized as needed to match the site’s navigation or design.
Note: WPComplete does not offer support for PHP programming or custom queries.
Conclusion
Using the wpcomplete_list_pages filter, developers can integrate WPComplete functionality directly into custom layouts or navigation. This approach is ideal for themes or plugins that require more control over page output. For more shortcode-based methods, see the WPComplete Shortcodes Documentation.