Making WordPress.org


Ignore:
Timestamp:
11/23/2022 02:00:20 AM (4 years ago)
Author:
adamwood
Message:

Learn: Sync with git WordPress/learn@b09aca7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/taxonomy.php

    r12259 r12268  
    1010add_action( 'init', __NAMESPACE__ . '\register' );
    1111add_action( 'audience_add_form_fields', __NAMESPACE__ . '\register_custom_fields' );
    12 add_action( 'wporg_lesson_category_add_form_fields', __NAMESPACE__ . '\register_custom_fields' );
    1312add_action( 'topic_add_form_fields', __NAMESPACE__ . '\register_custom_fields' );
    1413add_action( 'audience_edit_form_fields', __NAMESPACE__ . '\tax_edit_term_fields', 10, 2 );
    15 add_action( 'wporg_lesson_category_edit_form_fields', __NAMESPACE__ . '\tax_edit_term_fields', 10, 2 );
    1614add_action( 'topic_edit_form_fields', __NAMESPACE__ . '\tax_edit_term_fields', 10, 2 );
    1715add_action( 'created_audience', __NAMESPACE__ . '\tax_save_term_fields' );
    1816add_action( 'edited_audience', __NAMESPACE__ . '\tax_save_term_fields' );
    19 add_action( 'created_wporg_lesson_category', __NAMESPACE__ . '\tax_save_term_fields' );
    20 add_action( 'edited_wporg_lesson_category', __NAMESPACE__ . '\tax_save_term_fields' );
    2117add_action( 'created_topic', __NAMESPACE__ . '\tax_save_term_fields' );
    2218add_action( 'edited_topic', __NAMESPACE__ . '\tax_save_term_fields' );
     
    2723function register() {
    2824        register_lesson_audience();
    29         register_lesson_category();
    3025        register_lesson_duration();
    3126        register_lesson_group();
     
    8378
    8479        register_taxonomy( 'audience', array( 'lesson-plan' ), $args );
    85 }
    86 
    87 /**
    88  * Register the Lesson Category taxonomy.
    89  */
    90 function register_lesson_category() {
    91         $labels = array(
    92                 'name'                       => _x( 'Lesson Categories', 'Taxonomy General Name', 'wporg-learn' ),
    93                 'singular_name'              => _x( 'Lesson Category', 'Taxonomy Singular Name', 'wporg-learn' ),
    94                 'menu_name'                  => __( 'Categories', 'wporg-learn' ),
    95                 'all_items'                  => __( 'All Lesson Categories', 'wporg-learn' ),
    96                 'new_item_name'              => __( 'New Lesson Category', 'wporg-learn' ),
    97                 'add_new_item'               => __( 'Add New Lesson Category', 'wporg-learn' ),
    98                 'edit_item'                  => __( 'Edit Lesson Category', 'wporg-learn' ),
    99                 'update_item'                => __( 'Update Lesson Category', 'wporg-learn' ),
    100                 'view_item'                  => __( 'View Lesson Category', 'wporg-learn' ),
    101                 'separate_items_with_commas' => __( 'Separate lesson categories with commas', 'wporg-learn' ),
    102                 'add_or_remove_items'        => __( 'Add or remove lesson categories', 'wporg-learn' ),
    103                 'choose_from_most_used'      => __( 'Choose from the most used', 'wporg-learn' ),
    104                 'popular_items'              => __( 'Popular lesson categories', 'wporg-learn' ),
    105                 'search_items'               => __( 'Search lesson categories', 'wporg-learn' ),
    106                 'not_found'                  => __( 'Not Found', 'wporg-learn' ),
    107                 'no_terms'                   => __( 'No lesson categories', 'wporg-learn' ),
    108                 'items_list'                 => __( 'Lesson Categories list', 'wporg-learn' ),
    109                 'items_list_navigation'      => __( 'Lesson Categories list navigation', 'wporg-learn' ),
    110         );
    111 
    112         $args = array(
    113                 'labels'            => $labels,
    114                 'hierarchical'      => true,
    115                 'public'            => true,
    116                 'rewrite'           => array(
    117                         'slug' => 'lesson-plans',
    118                 ),
    119                 'show_ui'           => true,
    120                 'show_admin_column' => true,
    121                 'show_in_nav_menus' => false,
    122                 'show_tagcloud'     => false,
    123                 'show_in_rest'      => true,
    124                 'capabilities'      => array(
    125                         'assign_terms' => 'edit_lesson_plans',
    126                 ),
    127         );
    128 
    129         register_taxonomy( 'wporg_lesson_category', array( 'lesson-plan' ), $args );
    13080}
    13181
Note: See TracChangeset for help on using the changeset viewer.