Making WordPress.org


Ignore:
Timestamp:
08/25/2020 12:15:55 AM (6 years ago)
Author:
dufresnesteven
Message:

WordPress.org Learn: Sync with GitHub

File:
1 edited

Legend:

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

    r10169 r10202  
    99 */
    1010function register() {
    11         register_lesson_taxonomies();
    12 }
    13 
    14 /**
    15  * Register taxonomies for the lesson plan post type.
    16  */
    17 function register_lesson_taxonomies() {
    18         $labels = array(
    19                 'name'                       => _x( 'Categories', 'Taxonomy General Name', 'wporg_learn' ),
    20                 'singular_name'              => _x( 'Category', 'Taxonomy Singular Name', 'wporg_learn' ),
    21                 'menu_name'                  => __( 'Categories', 'wporg_learn' ),
    22                 'all_items'                  => __( 'All Categories', 'wporg_learn' ),
    23                 'new_item_name'              => __( 'New Category', 'wporg_learn' ),
    24                 'add_new_item'               => __( 'Add New Category', 'wporg_learn' ),
    25                 'edit_item'                  => __( 'Edit Category', 'wporg_learn' ),
    26                 'update_item'                => __( 'Update Category', 'wporg_learn' ),
    27                 'view_item'                  => __( 'View Category', 'wporg_learn' ),
    28                 'separate_items_with_commas' => __( 'Separate categories with commas', 'wporg_learn' ),
    29                 'add_or_remove_items'        => __( 'Add or remove categories', 'wporg_learn' ),
    30                 'choose_from_most_used'      => __( 'Choose from the most used', 'wporg_learn' ),
    31                 'popular_items'              => __( 'Popular categories', 'wporg_learn' ),
    32                 'search_items'               => __( 'Search categories', 'wporg_learn' ),
    33                 'not_found'                  => __( 'Not Found', 'wporg_learn' ),
    34                 'no_terms'                   => __( 'No categories', 'wporg_learn' ),
    35                 'items_list'                 => __( 'Categories list', 'wporg_learn' ),
    36                 'items_list_navigation'      => __( 'Categories list navigation', 'wporg_learn' ),
     11        register_lesson_audience();
     12        register_lesson_category();
     13        register_lesson_duration();
     14        register_lesson_group();
     15        register_lesson_instruction_type();
     16        register_lesson_level();
     17        register_workshop_series();
     18        register_workshop_topic();
     19}
     20
     21/**
     22 * Register the Lesson Audience taxonomy.
     23 */
     24function register_lesson_audience() {
     25        $labels = array(
     26                'name'                       => _x( 'Audiences', 'Taxonomy General Name', 'wporg-learn' ),
     27                'singular_name'              => _x( 'Audience', 'Taxonomy Singular Name', 'wporg-learn' ),
     28                'menu_name'                  => __( 'Audience', 'wporg-learn' ),
     29                'all_items'                  => __( 'All Audiences', 'wporg-learn' ),
     30                'parent_item'                => __( 'Parent Audience', 'wporg-learn' ),
     31                'parent_item_colon'          => __( 'Parent Audience:', 'wporg-learn' ),
     32                'new_item_name'              => __( 'New Audience Name', 'wporg-learn' ),
     33                'add_new_item'               => __( 'Add Audience', 'wporg-learn' ),
     34                'edit_item'                  => __( 'Edit Audience', 'wporg-learn' ),
     35                'update_item'                => __( 'Update Audience', 'wporg-learn' ),
     36                'view_item'                  => __( 'View Audience', 'wporg-learn' ),
     37                'separate_items_with_commas' => __( 'Separate Audiences with commas', 'wporg-learn' ),
     38                'add_or_remove_items'        => __( 'Add or remove Audiences', 'wporg-learn' ),
     39                'choose_from_most_used'      => __( 'Choose from the most used', 'wporg-learn' ),
     40                'popular_items'              => __( 'Popular Audiences', 'wporg-learn' ),
     41                'search_items'               => __( 'Search Audiences', 'wporg-learn' ),
     42                'not_found'                  => __( 'Not Found', 'wporg-learn' ),
     43                'no_terms'                   => __( 'No Audiences', 'wporg-learn' ),
     44                'items_list'                 => __( 'Audiences list', 'wporg-learn' ),
     45                'items_list_navigation'      => __( 'Audiences list navigation', 'wporg-learn' ),
     46        );
     47
     48        $args   = array(
     49                'labels'            => $labels,
     50                'hierarchical'      => false,
     51                'public'            => true,
     52                'show_ui'           => true,
     53                'show_admin_column' => true,
     54                'show_in_nav_menus' => true,
     55                'show_tagcloud'     => false,
     56                'show_in_rest'      => true,
     57        );
     58
     59        register_taxonomy( 'audience', array( 'lesson-plan' ), $args );
     60}
     61
     62/**
     63 * Register the Lesson Category taxonomy.
     64 */
     65function register_lesson_category() {
     66        $labels = array(
     67                'name'                       => _x( 'Categories', 'Taxonomy General Name', 'wporg-learn' ),
     68                'singular_name'              => _x( 'Category', 'Taxonomy Singular Name', 'wporg-learn' ),
     69                'menu_name'                  => __( 'Categories', 'wporg-learn' ),
     70                'all_items'                  => __( 'All Categories', 'wporg-learn' ),
     71                'new_item_name'              => __( 'New Category', 'wporg-learn' ),
     72                'add_new_item'               => __( 'Add New Category', 'wporg-learn' ),
     73                'edit_item'                  => __( 'Edit Category', 'wporg-learn' ),
     74                'update_item'                => __( 'Update Category', 'wporg-learn' ),
     75                'view_item'                  => __( 'View Category', 'wporg-learn' ),
     76                'separate_items_with_commas' => __( 'Separate categories with commas', 'wporg-learn' ),
     77                'add_or_remove_items'        => __( 'Add or remove categories', 'wporg-learn' ),
     78                'choose_from_most_used'      => __( 'Choose from the most used', 'wporg-learn' ),
     79                'popular_items'              => __( 'Popular categories', 'wporg-learn' ),
     80                'search_items'               => __( 'Search categories', 'wporg-learn' ),
     81                'not_found'                  => __( 'Not Found', 'wporg-learn' ),
     82                'no_terms'                   => __( 'No categories', 'wporg-learn' ),
     83                'items_list'                 => __( 'Categories list', 'wporg-learn' ),
     84                'items_list_navigation'      => __( 'Categories list navigation', 'wporg-learn' ),
    3785        );
    3886
    … …  
    53101        register_taxonomy( 'wporg_lesson_category', array( 'lesson-plan' ), $args );
    54102}
     103
     104/**
     105 * Register the Lesson Duration taxonomy.
     106 */
     107function register_lesson_duration() {
     108        $labels = array(
     109                'name'                       => _x( 'Duration', 'Taxonomy General Name', 'wporg-learn' ),
     110                'singular_name'              => _x( 'Duration', 'Taxonomy Singular Name', 'wporg-learn' ),
     111                'menu_name'                  => __( 'Duration', 'wporg-learn' ),
     112                'all_items'                  => __( 'All Durations', 'wporg-learn' ),
     113                'parent_item'                => __( 'Parent Duration', 'wporg-learn' ),
     114                'parent_item_colon'          => __( 'Parent Duration:', 'wporg-learn' ),
     115                'new_item_name'              => __( 'New Duration', 'wporg-learn' ),
     116                'add_new_item'               => __( 'Add New Duration', 'wporg-learn' ),
     117                'edit_item'                  => __( 'Edit Duration', 'wporg-learn' ),
     118                'update_item'                => __( 'Update Duration', 'wporg-learn' ),
     119                'view_item'                  => __( 'View Duration', 'wporg-learn' ),
     120                'separate_items_with_commas' => __( 'Separate durations with commas', 'wporg-learn' ),
     121                'add_or_remove_items'        => __( 'Add or remove durations', 'wporg-learn' ),
     122                'choose_from_most_used'      => __( 'Choose from the most used', 'wporg-learn' ),
     123                'popular_items'              => __( 'Popular durations', 'wporg-learn' ),
     124                'search_items'               => __( 'Search durations', 'wporg-learn' ),
     125                'not_found'                  => __( 'Not Found', 'wporg-learn' ),
     126                'no_terms'                   => __( 'No durations', 'wporg-learn' ),
     127                'items_list'                 => __( 'Durations list', 'wporg-learn' ),
     128                'items_list_navigation'      => __( 'Durations list navigation', 'wporg-learn' ),
     129        );
     130
     131        $args   = array(
     132                'labels'            => $labels,
     133                'hierarchical'      => false,
     134                'public'            => true,
     135                'show_ui'           => true,
     136                'show_admin_column' => true,
     137                'show_in_nav_menus' => false,
     138                'show_tagcloud'     => false,
     139                'show_in_rest'      => true,
     140        );
     141
     142        register_taxonomy( 'duration', array( 'lesson-plan' ), $args );
     143}
     144
     145/**
     146 * Register the Lesson Group taxonomy.
     147 */
     148function register_lesson_group() {
     149        $labels = array(
     150                'name'                       => _x( 'Lesson Groups', 'Lesson Plans associated to workshop group.', 'wporg-learn' ),
     151                'singular_name'              => _x( 'Lesson Group', 'Taxonomy Singular Name', 'wporg-learn' ),
     152                'menu_name'                  => __( 'Lesson Group', 'wporg-learn' ),
     153                'all_items'                  => __( 'All lesson groups', 'wporg-learn' ),
     154                'parent_item'                => __( 'Parent lesson group', 'wporg-learn' ),
     155                'parent_item_colon'          => __( 'Parent lesson group:', 'wporg-learn' ),
     156                'new_item_name'              => __( 'New lesson group Name', 'wporg-learn' ),
     157                'add_new_item'               => __( 'Add Lesson Group', 'wporg-learn' ),
     158                'edit_item'                  => __( 'Edit lesson group', 'wporg-learn' ),
     159                'update_item'                => __( 'Update lesson group', 'wporg-learn' ),
     160                'view_item'                  => __( 'View lesson group', 'wporg-learn' ),
     161                'separate_items_with_commas' => __( 'Separate lesson groups with commas', 'wporg-learn' ),
     162                'add_or_remove_items'        => __( 'Add or remove lesson groups', 'wporg-learn' ),
     163                'choose_from_most_used'      => __( 'Choose from the most used', 'wporg-learn' ),
     164                'popular_items'              => __( 'Popular lesson groups', 'wporg-learn' ),
     165                'search_items'               => __( 'Search lesson groups', 'wporg-learn' ),
     166                'not_found'                  => __( 'No lesson groups Found', 'wporg-learn' ),
     167                'no_terms'                   => __( 'No lesson groups', 'wporg-learn' ),
     168                'items_list'                 => __( 'Lesson groups list', 'wporg-learn' ),
     169                'items_list_navigation'      => __( 'Lesson groups list navigation', 'wporg-learn' ),
     170        );
     171
     172        $args = array(
     173                'labels'            => $labels,
     174                'hierarchical'      => true,
     175                'public'            => true,
     176                'show_ui'           => true,
     177                'show_admin_column' => true,
     178                'show_in_nav_menus' => true,
     179                'show_tagcloud'     => false,
     180                'show_in_rest'      => true,
     181        );
     182
     183        register_taxonomy( 'lesson_group', array( 'lesson-plan' ), $args );
     184}
     185
     186/**
     187 * Register the Lesson Instruction Type taxonomy.
     188 */
     189function register_lesson_instruction_type() {
     190        $labels = array(
     191                'name'                       => _x( 'Instruction Types', 'Taxonomy General Name', 'wporg-learn' ),
     192                'singular_name'              => _x( 'Instruction Type', 'Taxonomy Singular Name', 'wporg-learn' ),
     193                'menu_name'                  => __( 'Instruction Type', 'wporg-learn' ),
     194                'all_items'                  => __( 'All Instruction Types', 'wporg-learn' ),
     195                'parent_item'                => __( 'Parent Instruction Type', 'wporg-learn' ),
     196                'parent_item_colon'          => __( 'Parent Instruction Type:', 'wporg-learn' ),
     197                'new_item_name'              => __( 'New Instruction Type Name', 'wporg-learn' ),
     198                'add_new_item'               => __( 'Add Instruction Type', 'wporg-learn' ),
     199                'edit_item'                  => __( 'Edit Instruction Type', 'wporg-learn' ),
     200                'update_item'                => __( 'Update Instruction Type', 'wporg-learn' ),
     201                'view_item'                  => __( 'View Instruction Type', 'wporg-learn' ),
     202                'separate_items_with_commas' => __( 'Separate Instruction Types with commas', 'wporg-learn' ),
     203                'add_or_remove_items'        => __( 'Add or remove Instruction Types', 'wporg-learn' ),
     204                'choose_from_most_used'      => __( 'Choose from the most used', 'wporg-learn' ),
     205                'popular_items'              => __( 'Popular Instruction Types', 'wporg-learn' ),
     206                'search_items'               => __( 'Search Instruction Types', 'wporg-learn' ),
     207                'not_found'                  => __( 'Not Found', 'wporg-learn' ),
     208                'no_terms'                   => __( 'No Instruction Types', 'wporg-learn' ),
     209                'items_list'                 => __( 'Instruction Types list', 'wporg-learn' ),
     210                'items_list_navigation'      => __( 'Instruction Types list navigation', 'wporg-learn' ),
     211        );
     212
     213        $args   = array(
     214                'labels'            => $labels,
     215                'hierarchical'      => false,
     216                'public'            => true,
     217                'show_ui'           => true,
     218                'show_admin_column' => true,
     219                'show_in_nav_menus' => true,
     220                'show_tagcloud'     => false,
     221                'show_in_rest'      => true,
     222        );
     223
     224        register_taxonomy( 'instruction_type', array( 'lesson-plan' ), $args );
     225}
     226
     227/**
     228 * Register the Lesson Level taxonomy.
     229 */
     230function register_lesson_level() {
     231        $labels = array(
     232                'name'                       => _x( 'Experience Levels', 'Taxonomy General Name', 'wporg-learn' ),
     233                'singular_name'              => _x( 'Experience Level', 'Taxonomy Singular Name', 'wporg-learn' ),
     234                'menu_name'                  => __( 'Experience Level', 'wporg-learn' ),
     235                'all_items'                  => __( 'All Experience Levels', 'wporg-learn' ),
     236                'parent_item'                => __( 'Parent Experience Level', 'wporg-learn' ),
     237                'parent_item_colon'          => __( 'Parent Experience Level:', 'wporg-learn' ),
     238                'new_item_name'              => __( 'New Experience Level Name', 'wporg-learn' ),
     239                'add_new_item'               => __( 'Add New Experience Level', 'wporg-learn' ),
     240                'edit_item'                  => __( 'Edit Experience Level', 'wporg-learn' ),
     241                'update_item'                => __( 'Update Experience Level', 'wporg-learn' ),
     242                'view_item'                  => __( 'View Experience Level', 'wporg-learn' ),
     243                'separate_items_with_commas' => __( 'Separate experience levels with commas', 'wporg-learn' ),
     244                'add_or_remove_items'        => __( 'Add or remove experience levels', 'wporg-learn' ),
     245                'choose_from_most_used'      => __( 'Choose from the most used', 'wporg-learn' ),
     246                'popular_items'              => __( 'Popular Experience levels', 'wporg-learn' ),
     247                'search_items'               => __( 'Search Experience Levels', 'wporg-learn' ),
     248                'not_found'                  => __( 'Not Experience Found', 'wporg-learn' ),
     249                'no_terms'                   => __( 'No experience levels', 'wporg-learn' ),
     250                'items_list'                 => __( 'Experience Levels list', 'wporg-learn' ),
     251                'items_list_navigation'      => __( 'Experience Levels list navigation', 'wporg-learn' ),
     252        );
     253
     254        $args   = array(
     255                'labels'            => $labels,
     256                'hierarchical'      => false,
     257                'public'            => true,
     258                'show_ui'           => true,
     259                'show_admin_column' => true,
     260                'show_in_nav_menus' => true,
     261                'show_tagcloud'     => false,
     262                'show_in_rest'      => true,
     263        );
     264
     265        register_taxonomy( 'level', array( 'lesson-plan' ), $args );
     266}
     267
     268/**
     269 * Register the Workshop Series taxonomy.
     270 */
     271function register_workshop_series() {
     272        $labels = array(
     273                'name'                       => _x( 'Workshop Series', 'taxonomy general name', 'wporg-learn' ),
     274                'singular_name'              => _x( 'Workshop Series', 'taxonomy singular name', 'wporg-learn' ),
     275                'menu_name'                  => __( 'Series', 'wporg-learn' ),
     276                'all_items'                  => __( 'All Series', 'wporg-learn' ),
     277                'new_item_name'              => __( 'New Series Name', 'wporg-learn' ),
     278                'add_new_item'               => __( 'Add Series', 'wporg-learn' ),
     279                'edit_item'                  => __( 'Edit Series', 'wporg-learn' ),
     280                'update_item'                => __( 'Update Series', 'wporg-learn' ),
     281                'view_item'                  => __( 'View Series', 'wporg-learn' ),
     282                'separate_items_with_commas' => __( 'Separate series with commas', 'wporg-learn' ),
     283                'add_or_remove_items'        => __( 'Add or remove series', 'wporg-learn' ),
     284                'choose_from_most_used'      => __( 'Choose from the most used', 'wporg-learn' ),
     285                'popular_items'              => __( 'Popular Series', 'wporg-learn' ),
     286                'search_items'               => __( 'Search Series', 'wporg-learn' ),
     287                'not_found'                  => __( 'No series found', 'wporg-learn' ),
     288                'no_terms'                   => __( 'No series ', 'wporg-learn' ),
     289                'items_list'                 => __( 'Series list', 'wporg-learn' ),
     290                'items_list_navigation'      => __( 'Series list navigation', 'wporg-learn' ),
     291                'back_to_items'              => __( '← Back to Series', 'wporg-learn' ),
     292        );
     293
     294        $args = array(
     295                'labels'            => $labels,
     296                'hierarchical'      => false,
     297                'public'            => true,
     298                'rewrite'           => array(
     299                        'slug' => 'workshops',
     300                ),
     301                'show_ui'           => true,
     302                'show_admin_column' => true,
     303                'show_in_nav_menus' => true,
     304                'show_tagcloud'     => false,
     305                'show_in_rest'      => true,
     306        );
     307
     308        register_taxonomy( 'wporg_workshop_series', array( 'wporg_workshop' ), $args );
     309}
     310
     311/**
     312 * Register the Workshop Topic taxonomy.
     313 */
     314function register_workshop_topic() {
     315        $labels = array(
     316                'name'                       => _x( 'Topics', 'Topic Plans associated to workshop.', 'wporg-learn' ),
     317                'singular_name'              => _x( 'Topic', 'Taxonomy Singular Name', 'wporg-learn' ),
     318                'menu_name'                  => __( 'Topics', 'wporg-learn' ),
     319                'all_items'                  => __( 'All topic', 'wporg-learn' ),
     320                'parent_item'                => __( 'Parent topic', 'wporg-learn' ),
     321                'parent_item_colon'          => __( 'Parent topic:', 'wporg-learn' ),
     322                'new_item_name'              => __( 'New Topic Name', 'wporg-learn' ),
     323                'add_new_item'               => __( 'Add Topic', 'wporg-learn' ),
     324                'edit_item'                  => __( 'Edit Topic', 'wporg-learn' ),
     325                'update_item'                => __( 'Update Topic', 'wporg-learn' ),
     326                'view_item'                  => __( 'View Topic', 'wporg-learn' ),
     327                'separate_items_with_commas' => __( 'Separate Topic with commas', 'wporg-learn' ),
     328                'add_or_remove_items'        => __( 'Add or remove Topic', 'wporg-learn' ),
     329                'choose_from_most_used'      => __( 'Choose from the most used', 'wporg-learn' ),
     330                'popular_items'              => __( 'Popular Topics', 'wporg-learn' ),
     331                'search_items'               => __( 'Search Topics', 'wporg-learn' ),
     332                'not_found'                  => __( 'No Topic Found', 'wporg-learn' ),
     333                'no_terms'                   => __( 'No Topic ', 'wporg-learn' ),
     334                'items_list'                 => __( 'Topic list', 'wporg-learn' ),
     335                'items_list_navigation'      => __( 'Topic list navigation', 'wporg-learn' ),
     336        );
     337
     338        $args = array(
     339                'labels'            => $labels,
     340                'hierarchical'      => false,
     341                'public'            => true,
     342                'show_ui'           => true,
     343                'show_admin_column' => true,
     344                'show_in_nav_menus' => true,
     345                'show_tagcloud'     => false,
     346                'show_in_rest'      => true,
     347        );
     348
     349        register_taxonomy( 'topic', array( 'wporg_workshop' ), $args );
     350}
Note: See TracChangeset for help on using the changeset viewer.