PHP Класс Extended_Taxonomy_Admin, extended-taxos

Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$args
$taxo

Защищенные свойства (Protected)

Свойство Тип Описание
$_cols
$defaults array Default arguments for custom taxonomies.
$the_cols

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

Метод Описание
__construct ( Extended_Taxonomy $taxo, array $args = [] ) Class constructor.
_log_default_cols ( array $cols ) : array Logs the default columns so we don't remove any custom columns added by other plugins.
col ( string $string, $col, integer $term_id ) Output the column data for our custom columns.
col_term_meta ( string $meta_key, array $args, integer $term_id ) Output column data for a term meta field.
cols ( array $cols ) : array Add columns to the admin screen for this taxonomy.
glance_items ( array $items ) : array Add our taxonomy to the 'At a Glance' widget on the WordPress 3.8+ dashboard.
meta_box_dropdown ( WP_Post $post, array $meta_box ) : null Display the 'dropdown' meta box on the post editing screen.
meta_box_radio ( WP_Post $post, array $meta_box ) : null Display the 'radio' meta box on the post editing screen.
meta_box_simple ( WP_Post $post, array $meta_box ) : null Display the 'simple' meta box on the post editing screen.
meta_boxes ( string $object_type, mixed $object ) : null Remove the default meta box from the post editing screen and add our custom meta box.
n ( string $single, string $plural, integer $number ) : string A non-localised version of _n()
term_updated_messages ( array $messages ) : array Add our term updated messages.

Защищенные методы

Метод Описание
do_meta_box ( WP_Post $post, Walker $walker = null, boolean $show_none = false, string $type = 'checklist' ) : null Display a meta box on the post editing screen.
get_item_title ( array $item ) : string Get a sensible title for the current item (usually the arguments array for a column)

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

__construct() публичный Метод

Class constructor.
public __construct ( Extended_Taxonomy $taxo, array $args = [] )
$taxo Extended_Taxonomy An extended taxonomy object
$args array The admin arguments

_log_default_cols() публичный Метод

Logs the default columns so we don't remove any custom columns added by other plugins.
public _log_default_cols ( array $cols ) : array
$cols array The default columns for this taxonomy screen
Результат array The default columns for this taxonomy screen

col() публичный Метод

Output the column data for our custom columns.
public col ( string $string, $col, integer $term_id )
$string string Blank string.
$term_id integer Term ID.

col_term_meta() публичный Метод

Output column data for a term meta field.
public col_term_meta ( string $meta_key, array $args, integer $term_id )
$meta_key string The term meta key
$args array Optional. Array of arguments for this field
$term_id integer Term ID.

cols() публичный Метод

Each item in the admin_cols array is either a string name of an existing column, or an associative array of information for a custom column. Defining a custom column is easy. Just define an array which includes the column title, column type, and optional callback function. You can display columns for term meta or custom functions. The example below adds two columns; one which displays the value of the term's term_updated meta key, and one which calls a custom callback function: register_extended_taxonomy( 'foo', 'bar', array( 'admin_cols' => array( 'foo_updated' => array( 'title' => 'Updated', 'meta_key' => 'term_updated' ), 'foo_bar' => array( 'title' => 'Example', 'function' => 'my_custom_callback' ) ) ) ); That's all you need to do. The columns will handle safely outputting the data (escaping text, and comma-separating taxonomy terms). No more messing about with all of those annoyingly named column filters and actions. Each item in the admin_cols array must contain one of the following elements which defines the column type: - meta_key - A term meta key - function - The name of a callback function The value for the corresponding term meta are safely escaped and output into the column. There are a few optional elements: - title - Generated from the field if not specified. - function - The name of a callback function for the column (eg. my_function) which gets called instead of the built-in function for handling that column. The function is passed the term ID as its first parameter. - date_format - This is used with the meta_key column type. The value of the meta field will be treated as a timestamp if this is present. Unix and MySQL format timestamps are supported in the meta value. Pass in boolean true to format the date according to the 'Date Format' setting, or pass in a valid date formatting string (eg. d/m/Y H:i:s). - cap - A capability required in order for this column to be displayed to the current user. Defaults to null, meaning the column is shown to all users. Note that sortable admin columns are not yet supported.
public cols ( array $cols ) : array
$cols array Associative array of columns
Результат array Updated array of columns

do_meta_box() защищенный Метод

Display a meta box on the post editing screen.
protected do_meta_box ( WP_Post $post, Walker $walker = null, boolean $show_none = false, string $type = 'checklist' ) : null
$post WP_Post The post object
$walker Walker An optional term walker
$show_none boolean Whether to include a 'none' item in the term list
$type string The taxonomy list type (checklist or dropdown)
Результат null

get_item_title() защищенный Метод

Get a sensible title for the current item (usually the arguments array for a column)
protected get_item_title ( array $item ) : string
$item array An array of arguments
Результат string The item title

glance_items() публичный Метод

Add our taxonomy to the 'At a Glance' widget on the WordPress 3.8+ dashboard.
public glance_items ( array $items ) : array
$items array Array of items to display on the widget.
Результат array Updated array of items.

meta_box_dropdown() публичный Метод

Uses the Walker_ExtendedTaxonomyDropdown class for the walker.
public meta_box_dropdown ( WP_Post $post, array $meta_box ) : null
$post WP_Post The post object
$meta_box array The meta box arguments
Результат null

meta_box_radio() публичный Метод

Uses the Walker_ExtendedTaxonomyRadios class for the walker.
public meta_box_radio ( WP_Post $post, array $meta_box ) : null
$post WP_Post The post object
$meta_box array The meta box arguments
Результат null

meta_box_simple() публичный Метод

Display the 'simple' meta box on the post editing screen.
public meta_box_simple ( WP_Post $post, array $meta_box ) : null
$post WP_Post The post object
$meta_box array The meta box arguments
Результат null

meta_boxes() публичный Метод

Remove the default meta box from the post editing screen and add our custom meta box.
public meta_boxes ( string $object_type, mixed $object ) : null
$object_type string The object type (eg. the post type)
$object mixed The object (eg. a WP_Post object)
Результат null

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

A non-localised version of _n()
public static n ( string $single, string $plural, integer $number ) : string
$single string The text that will be used if $number is 1
$plural string The text that will be used if $number is not 1
$number integer The number to compare against to use either $single or $plural
Результат string Either $single or $plural text

term_updated_messages() публичный Метод

The messages are as follows: 1 => "Term added." 2 => "Term deleted." 3 => "Term updated." 4 => "Term not added." 5 => "Term not updated." 6 => "Terms deleted."
public term_updated_messages ( array $messages ) : array
$messages array An associative array of term updated messages with taxonomy name as keys.
Результат array Updated array of term updated messages.

Описание свойств

$_cols защищенное свойство

protected $_cols

$args публичное свойство

public $args

$defaults защищенное свойство

Default arguments for custom taxonomies.
protected array $defaults
Результат array

$taxo публичное свойство

public $taxo

$the_cols защищенное свойство

protected $the_cols