Created
February 13, 2019 14:02
-
-
Save jakerb/200f98ca05aa196a12967a50acee2123 to your computer and use it in GitHub Desktop.
List App Pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'post_type' => 'app_pages', | |
'posts_per_page' => -1, | |
'orderby' => 'title', | |
'order' => 'ASC' | |
); | |
$app_pages = new WP_Query( $args ); | |
$output = array(); | |
foreach($app_pages->posts as $i => $page) { | |
//add some arbitrary text as a new field. | |
$page->newvar = "The index is {$i}"; | |
//add it to the output array | |
$output[] = $page; | |
} | |
return $output; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment