Skip to content

Instantly share code, notes, and snippets.

@jakerb
Created February 13, 2019 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakerb/200f98ca05aa196a12967a50acee2123 to your computer and use it in GitHub Desktop.
Save jakerb/200f98ca05aa196a12967a50acee2123 to your computer and use it in GitHub Desktop.
List App Pages
<?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