AnsPress_Category::register_question_categories()
Description #
Register category taxonomy for question cpt.
Source #
File: addons/free/category.php
public static function register_question_categories() { ap_add_default_options([ 'form_category_orderby' => 'count', 'categories_page_order' => 'DESC', 'categories_page_orderby' => 'count', 'category_page_slug' => 'category', 'categories_per_page' => 20, 'categories_image_height' => 150, ]); /** * Labels for category taxonomy. * * @var array */ $categories_labels = array( 'name' => __( 'Question Categories', 'anspress-question-answer' ), 'singular_name' => __( 'Category', 'anspress-question-answer' ), 'all_items' => __( 'All Categories', 'anspress-question-answer' ), 'add_new_item' => __( 'Add New Category', 'anspress-question-answer' ), 'edit_item' => __( 'Edit Category', 'anspress-question-answer' ), 'new_item' => __( 'New Category', 'anspress-question-answer' ), 'view_item' => __( 'View Category', 'anspress-question-answer' ), 'search_items' => __( 'Search Category', 'anspress-question-answer' ), 'not_found' => __( 'Nothing Found', 'anspress-question-answer' ), 'not_found_in_trash' => __( 'Nothing found in Trash', 'anspress-question-answer' ), 'parent_item_colon' => '', ); /** * FILTER: ap_question_category_labels * Filter ic called before registering question_category taxonomy */ $categories_labels = apply_filters( 'ap_question_category_labels', $categories_labels ); /** * Arguments for category taxonomy * * @var array * @since 2.0 */ $category_args = array( 'hierarchical' => true, 'labels' => $categories_labels, 'rewrite' => false, 'publicly_queryable' => true, ); /** * Filter is called before registering question_category taxonomy. * * @param array $category_args Category arguments. */ $category_args = apply_filters( 'ap_question_category_args', $category_args ); /** * Now let WordPress know about our taxonomy */ register_taxonomy( 'question_category', [ 'question' ], $category_args ); }
Expand full source code Collapse full source code View on GitHub: addons/free/category.php:155
Add your comment