PHP Класс WPLib_Posts, wplib

Наследование: extends WPLib_Module_Base
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
_clear_post_type_args ( ) Run on WordPress's 'init' hook to register all the post types defined in classes that extend this class.
_get_post_type_label ( string $post_type, string $label_type ) : string
_get_post_type_labels ( string $post_type ) : array
_init ( ) Run on WordPress's 'init' hook to register all the post types defined in classes that extend this class.
_init_99 ( ) Clear out this data, we don't need them anymore But do it late so that a regular 'init' can still access them, i.e. for changing labels of 'post' post type.
_set_post_type_args ( string $post_type_slug, array $args ) Save $args for later passing to register_post_type().
_set_post_type_labels ( string $post_type, array $args ) : array
_wp_loaded ( ) Add a property to post type objects so they can be self-identified.
default_post_type_labels ( ) : array
get_list ( array | string | WPLib_Query $query = [], array $args = [] ) : WPLib_Post_List_Default
get_post ( WP_Post | object | integer | string | array | null | boolean $_post, string | boolean $post_type = false ) : null | WP_Post
get_post_by ( string $by, integer | string $value, array $args = [] ) : WP_Post
get_post_type_class ( string $post_type ) : string | null
get_post_types_supporting ( string $feature ) : array Get a list of post types that support a specific named feature.
get_posts ( WP_Query | array $args = [] ) : WP_Post[] Query the posts, return a post list.
get_queried_post_type ( ) : false | null | string Return the post type of the queried object.
get_query ( array $args = [] ) : WPLib_Query Query the posts. Equivalent to creating a new WP_Query which both instantiates and queries the DB.
make_new_item ( WP_Post | integer $_post, array $args = [] ) : mixed Create new Instance of a Post MVI
max_posts_per_page ( ) : integer
on_load ( ) Run on WordPress's 'init' hook to register all the post types defined in classes that extend this class.
pop_post ( )
post_type_classes ( ) : string[]
push_post ( WP_Post | boolean $value = false )
set_max_posts_per_page ( integer $value )

Описание методов

_clear_post_type_args() статический публичный Метод

Run on WordPress's 'init' hook to register all the post types defined in classes that extend this class.
static public _clear_post_type_args ( )

_get_post_type_label() статический публичный Метод

static public _get_post_type_label ( string $post_type, string $label_type ) : string
$post_type string
$label_type string
Результат string

_get_post_type_labels() статический публичный Метод

static public _get_post_type_labels ( string $post_type ) : array
$post_type string
Результат array

_init() статический публичный Метод

Run on WordPress's 'init' hook to register all the post types defined in classes that extend this class.
static public _init ( )

_init_99() статический публичный Метод

Clear out this data, we don't need them anymore But do it late so that a regular 'init' can still access them, i.e. for changing labels of 'post' post type.
static public _init_99 ( )

_set_post_type_args() статический публичный Метод

Save $args for later passing to register_post_type().
static public _set_post_type_args ( string $post_type_slug, array $args )
$post_type_slug string
$args array

_set_post_type_labels() статический публичный Метод

static public _set_post_type_labels ( string $post_type, array $args ) : array
$post_type string
$args array
Результат array

_wp_loaded() статический публичный Метод

Add a property to post type objects so they can be self-identified.
static public _wp_loaded ( )

default_post_type_labels() статический публичный Метод

static public default_post_type_labels ( ) : array
Результат array

get_list() статический публичный Метод

static public get_list ( array | string | WPLib_Query $query = [], array $args = [] ) : WPLib_Post_List_Default
$query array | string | WPLib_Query
$args array
Результат WPLib_Post_List_Default

get_post() статический публичный Метод

static public get_post ( WP_Post | object | integer | string | array | null | boolean $_post, string | boolean $post_type = false ) : null | WP_Post
$_post WP_Post | object | integer | string | array | null | boolean
$post_type string | boolean
Результат null | WP_Post

get_post_by() статический публичный Метод

static public get_post_by ( string $by, integer | string $value, array $args = [] ) : WP_Post
$by string
$value integer | string
$args array
Результат WP_Post

get_post_type_class() статический публичный Метод

static public get_post_type_class ( string $post_type ) : string | null
$post_type string
Результат string | null

get_post_types_supporting() статический публичный Метод

Get a list of post types that support a specific named feature.
static public get_post_types_supporting ( string $feature ) : array
$feature string
Результат array

get_posts() статический публичный Метод

Query the posts, return a post list.
static public get_posts ( WP_Query | array $args = [] ) : WP_Post[]
$args WP_Query | array
Результат WP_Post[]

get_queried_post_type() статический публичный Метод

Return the post type of the queried object.
static public get_queried_post_type ( ) : false | null | string
Результат false | null | string

get_query() статический публичный Метод

Query the posts. Equivalent to creating a new WP_Query which both instantiates and queries the DB.
См. также: https://github.com/wplib/wplib/commit/8dc27c368e84f7ba6e1448753e1b1f082a60ac6d#commitcomment-11026403
static public get_query ( array $args = [] ) : WPLib_Query
$args array
Результат WPLib_Query

make_new_item() статический публичный Метод

Create new Instance of a Post MVI
static public make_new_item ( WP_Post | integer $_post, array $args = [] ) : mixed
$_post WP_Post | integer
$args array { @type string $instance_class @type string $list_owner }
Результат mixed

max_posts_per_page() статический публичный Метод

static public max_posts_per_page ( ) : integer
Результат integer

on_load() статический публичный Метод

Run on WordPress's 'init' hook to register all the post types defined in classes that extend this class.
static public on_load ( )

pop_post() статический публичный Метод

static public pop_post ( )

post_type_classes() статический публичный Метод

static public post_type_classes ( ) : string[]
Результат string[]

push_post() статический публичный Метод

static public push_post ( WP_Post | boolean $value = false )
$value WP_Post | boolean

set_max_posts_per_page() статический публичный Метод

static public set_max_posts_per_page ( integer $value )
$value integer