PHP 클래스 Extended_CPT

파일 보기 프로젝트 열기: johnbillion/extended-cpts 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$args
$post_plural
$post_plural_low
$post_singular
$post_singular_low
$post_slug
$post_type Some other member variables you don't need to worry about:

보호된 프로퍼티들

프로퍼티 타입 설명
$defaults array The arguments listed are the ones which differ from the defaults in register_post_type().

공개 메소드들

메소드 설명
__construct ( string $post_type, array $args = [], array $names = [] ) Class constructor.
add_query_vars ( array $vars ) : array Add our filter names to the public query vars.
add_taxonomy ( string $taxonomy, array $args = [], array $names = [] ) : object | false Helper function for registering a taxonomy and adding it to this post type.
add_to_feed ( array $vars ) : array Add our post type to the feed.
extend ( stdClass | WP_Post_Type $pto ) Extends an existing post type object. Currently only handles labels.
get_filter_vars ( array $query, array $filters ) : array Get the array of private query vars for the given filters, to apply to the current query in order to filter it by the given public query vars.
get_sort_field_vars ( array $vars, array $sortables ) : array Get the array of private and public query vars for the given sortables, to apply to the current query in order to sort it by the requested orderby field.
get_sort_taxonomy_clauses ( array $clauses, array $vars, array $sortables ) : array Get the array of SQL clauses for the given sortables, to apply to the current query in order to sort it by the requested orderby field.
maybe_filter ( WP_Query $wp_query ) Set the relevant query vars for filtering posts by our front-end filters.
maybe_sort_by_fields ( WP_Query $wp_query ) Set the relevant query vars for sorting posts by our front-end sortables.
maybe_sort_by_taxonomy ( array $clauses, WP_Query $wp_query ) : array Filter the query's SQL clauses so we can sort posts by taxonomy terms.
override_private_query_vars ( WP $wp ) : WP Add to or override our post type archive's private query vars.
post_type_link ( string $post_link, WP_Post $post, boolean $leavename, boolean $sample ) : string Filter the post type permalink in order to populate its rewrite tags.
register_post_type ( ) Registers our post type.
registered_post_type ( string $post_type, stdClass | WP_Post_Type $args ) Action fired after a CPT is registered in order to set up the custom permalink structure for the post type.
rewrite_testing_tests ( array $tests ) : array Add our rewrite tests to the Rewrite Rule Testing tests array.

메소드 상세

__construct() 공개 메소드

Class constructor.
또한 보기: register_extended_post_type()
public __construct ( string $post_type, array $args = [], array $names = [] )
$post_type string The post type name.
$args array Optional. The post type arguments.
$names array Optional. The plural, singular, and slug names.

add_query_vars() 공개 메소드

Add our filter names to the public query vars.
public add_query_vars ( array $vars ) : array
$vars array Public query variables.
리턴 array Updated public query variables.

add_taxonomy() 공개 메소드

Accepts the same parameters as register_extended_taxonomy(), minus the $object_type parameter. Will fall back to register_taxonomy() if Extended Taxonomies isn't present. Example usage: $events = register_extended_post_type( 'event' ); $location = $events->add_taxonomy( 'location' );
public add_taxonomy ( string $taxonomy, array $args = [], array $names = [] ) : object | false
$taxonomy string The taxonomy name.
$args array Optional. The taxonomy arguments.
$names array Optional. An associative array of the plural, singular, and slug names.
리턴 object | false Taxonomy object, or boolean false if there's a problem.

add_to_feed() 공개 메소드

Add our post type to the feed.
public add_to_feed ( array $vars ) : array
$vars array Request parameters.
리턴 array Updated request parameters.

extend() 공개 메소드

Extends an existing post type object. Currently only handles labels.
public extend ( stdClass | WP_Post_Type $pto )
$pto stdClass | WP_Post_Type A post type object

get_filter_vars() 공개 정적인 메소드

Get the array of private query vars for the given filters, to apply to the current query in order to filter it by the given public query vars.
public static get_filter_vars ( array $query, array $filters ) : array
$query array The public query vars, usually from `$wp_query->query`.
$filters array The filters valid for this query (usually the value of the `admin_filters` or `site_filters` argument when registering an extended post type).
리턴 array The list of private query vars to apply to the query.

get_sort_field_vars() 공개 정적인 메소드

Get the array of private and public query vars for the given sortables, to apply to the current query in order to sort it by the requested orderby field.
public static get_sort_field_vars ( array $vars, array $sortables ) : array
$vars array The public query vars, usually from `$wp_query->query`.
$sortables array The sortables valid for this query (usually the value of the `admin_cols` or `site_sortables` argument when registering an extended post type.
리턴 array The list of private and public query vars to apply to the query.

get_sort_taxonomy_clauses() 공개 정적인 메소드

Get the array of SQL clauses for the given sortables, to apply to the current query in order to sort it by the requested orderby field.
public static get_sort_taxonomy_clauses ( array $clauses, array $vars, array $sortables ) : array
$clauses array The query's SQL clauses.
$vars array The public query vars, usually from `$wp_query->query`.
$sortables array The sortables valid for this query (usually the value of the `admin_cols` or `site_sortables` argument when registering an extended post type).
리턴 array The list of SQL clauses to apply to the query.

maybe_filter() 공개 메소드

Set the relevant query vars for filtering posts by our front-end filters.
public maybe_filter ( WP_Query $wp_query )
$wp_query WP_Query The current WP_Query object.

maybe_sort_by_fields() 공개 메소드

Set the relevant query vars for sorting posts by our front-end sortables.
public maybe_sort_by_fields ( WP_Query $wp_query )
$wp_query WP_Query The current WP_Query object.

maybe_sort_by_taxonomy() 공개 메소드

Filter the query's SQL clauses so we can sort posts by taxonomy terms.
public maybe_sort_by_taxonomy ( array $clauses, WP_Query $wp_query ) : array
$clauses array The current query's SQL clauses.
$wp_query WP_Query The current `WP_Query` object.
리턴 array The updated SQL clauses.

override_private_query_vars() 공개 메소드

Add to or override our post type archive's private query vars.
public override_private_query_vars ( WP $wp ) : WP
$wp WP The WP request object.
리턴 WP Updated WP request object.

post_type_link() 공개 메소드

Filter the post type permalink in order to populate its rewrite tags.
public post_type_link ( string $post_link, WP_Post $post, boolean $leavename, boolean $sample ) : string
$post_link string The post's permalink.
$post WP_Post The post in question.
$leavename boolean Whether to keep the post name.
$sample boolean Is it a sample permalink.
리턴 string The post's permalink.

register_post_type() 공개 메소드

The only difference between this and regular register_post_type() calls is this will trigger an error of E_USER_ERROR level if a WP_Error is returned.
public register_post_type ( )

registered_post_type() 공개 메소드

Action fired after a CPT is registered in order to set up the custom permalink structure for the post type.
public registered_post_type ( string $post_type, stdClass | WP_Post_Type $args )
$post_type string Post type name.
$args stdClass | WP_Post_Type Arguments used to register the post type.

rewrite_testing_tests() 공개 메소드

Add our rewrite tests to the Rewrite Rule Testing tests array.
public rewrite_testing_tests ( array $tests ) : array
$tests array The existing rewrite rule tests.
리턴 array Updated rewrite rule tests.

프로퍼티 상세

$args 공개적으로 프로퍼티

public $args

$defaults 보호되어 있는 프로퍼티

The arguments listed are the ones which differ from the defaults in register_post_type().
protected array $defaults
리턴 array

$post_plural 공개적으로 프로퍼티

public $post_plural

$post_plural_low 공개적으로 프로퍼티

public $post_plural_low

$post_singular 공개적으로 프로퍼티

public $post_singular

$post_singular_low 공개적으로 프로퍼티

public $post_singular_low

$post_slug 공개적으로 프로퍼티

public $post_slug

$post_type 공개적으로 프로퍼티

Some other member variables you don't need to worry about:
public $post_type