Skip to content

Instantly share code, notes, and snippets.

@DrewAPicture
Last active December 21, 2015 23:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DrewAPicture/6384436 to your computer and use it in GitHub Desktop.
Save DrewAPicture/6384436 to your computer and use it in GitHub Desktop.
get_pages args docs
<?php
/**
* WP Docs Collection Class
*
* Stores data sets commonly referenced in WordPress inline documentation.
*
* @since 3.7.0
*/
class WP_Docs {
/**
* Post Fields
*
* @access private
* @since 3.7.0
*/
private static $_post_fields = array(
'ID', 'post_author', 'post_date', 'post_date_gmt',
'post_content', 'post_title', 'post_excerpt',
'post_status', 'comment_status', 'ping_status',
'post_password', 'post_name', 'to_ping', 'pinged',
'post_modified', 'post_modified_gmt',
'post_content_filtered', 'post_parent', 'guid',
'menu_order', 'post_type', 'post_mime_type','comment_count'
);
/**
* Retrieve Post Fields
*
* @since 3.7.0
* @return array The post fields.
* /
public static function post_fields() {
return self::$_post_fields;
}
} // WP_Docs_Collection
<?php
/**
* Retrieve a list of pages.
*
* @global wpdb $wpdb WordPress Database Access Abstraction Object
*
* @since 1.5.0
*
* @param mixed $args (optional) Array or string of options {
* @type int 'child_of' Page ID to return child and grandchild pages of (default 0).
* @type string 'sort_order' How to sort retrieved pages (default 'ASC', accepts 'ASC', 'DESC').
* @type string 'sort_column' What column to sort pages by (default 'post_title', accepts posts fields, @see WP_Docs::post_fields()).
* @type bool|int 'hierarchical' Whether to return pages hierarchically (default 1|true, accepts 1|true, 0|false).
* @type array 'exclude' Array of page IDs to exclude (default array).
* @type array 'include' Array of page IDs to include (default array).
* @type string 'meta_key' Only include pages with this meta key (default empty).
* @type string 'meta_value' Only include pages with this meta value (default empty).
* @type string 'authors' A comma-separated list of author IDs (default empty).
* @type int 'parent' Page ID to return direct children of. 'hierarchical' must be 0|false (default -1).
* @type int 'exclude_tree' Remove all children of given ID from returned pages (default empty).
* @type int 'number' The number of pages to return (default empty).
* @type int 'offset' The number of pages to skip before returning (default 0).
* @type string 'post_type' The post type to return (default 'page').
* @type string 'post_status' A comma-separated list of status types to include (default 'publish').
* }
* @return array List of pages matching defaults or $args
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment