Making WordPress.org


Ignore:
Timestamp:
08/13/2020 11:43:14 PM (6 years ago)
Author:
coreymckrill
Message:

WordPress.org Learn: Sync with GitHub

https://github.com/WordPress/learn/compare/1accd3db38a60230689bdc157f9e82081d35d163...38e7793fd20434d72ca898988d017ba2009fb677

File:
1 edited

Legend:

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

    r10142 r10169  
    44class Lesson_Plan {
    55
    6 /**
    7   *  Register Lesson Plan Post Type
    8   */
    9 public static function lesson_plan_post_type() {
    10 
    11         $labels = array(
    12                 'name'                  => _x( 'Lesson Plans', 'Post Type General Name', 'wporg_learn' ),
    13                 'singular_name'         => _x( 'Lesson Plan', 'Post Type Singular Name', 'wporg_learn' ),
    14                 'menu_name'             => __( 'Lesson Plans', 'wporg_learn' ),
    15                 'name_admin_bar'        => __( 'Lesson Plan', 'wporg_learn' ),
    16                 'archives'              => __( 'Lesson Archives', 'wporg_learn' ),
    17                 'attributes'            => __( 'Lesson Attributes', 'wporg_learn' ),
    18                 'parent_item_colon'     => __( 'Parent Lesson:', 'wporg_learn' ),
    19                 'all_items'             => __( 'All Lessons', 'wporg_learn' ),
    20                 'add_new_item'          => __( 'Add New Lesson', 'wporg_learn' ),
    21                 'add_new'               => __( 'Add New', 'wporg_learn' ),
    22                 'new_item'              => __( 'New Lesson Plan', 'wporg_learn' ),
    23                 'edit_item'             => __( 'Edit Lesson Plan', 'wporg_learn' ),
    24                 'update_item'           => __( 'Update Lesson Plan', 'wporg_learn' ),
    25                 'view_item'             => __( 'View Lesson', 'wporg_learn' ),
    26                 'view_items'            => __( 'View Lessons', 'wporg_learn' ),
    27                 'search_items'          => __( 'Search Lesson', 'wporg_learn' ),
    28                 'not_found'             => __( 'Not found', 'wporg_learn' ),
    29                 'not_found_in_trash'    => __( 'Not found in Trash', 'wporg_learn' ),
    30                 'featured_image'        => __( 'Featured Image', 'wporg_learn' ),
    31                 'set_featured_image'    => __( 'Set featured image', 'wporg_learn' ),
    32                 'remove_featured_image' => __( 'Remove featured image', 'wporg_learn' ),
    33                 'use_featured_image'    => __( 'Use as featured image', 'wporg_learn' ),
    34                 'insert_into_item'      => __( 'Insert into lesson', 'wporg_learn' ),
    35                 'uploaded_to_this_item' => __( 'Uploaded to this lesson', 'wporg_learn' ),
    36                 'items_list'            => __( 'Lessons list', 'wporg_learn' ),
    37                 'items_list_navigation' => __( 'Lessons list navigation', 'wporg_learn' ),
    38                 'filter_items_list'     => __( 'Filter Lessons list', 'wporg_learn' ),
    39         );
    40         $args = array(
    41                 'label'                 => __( 'Lesson Plan', 'wporg_learn' ),
    42                 'description'           => __( 'WordPress.org Training Lesson Plan', 'wporg_learn' ),
    43                 'labels'                => $labels,
    44                 'supports'              => array( 'title', 'editor', 'comments', 'revisions', 'custom-fields' ),
    45                 'taxonomies'            => array( 'duration', 'level', 'audience', 'instruction_type' ),
    46                 'hierarchical'          => true,
    47                 'public'                => true,
    48                 'show_ui'               => true,
    49                 'show_in_menu'          => true,
    50                 'menu_position'         => 5,
    51                 'menu_icon'             => 'dashicons-welcome-learn-more',
    52                 'show_in_admin_bar'     => true,
    53                 'show_in_nav_menus'     => true,
    54                 'can_export'            => true,
    55                 'has_archive'           => 'lesson-plans',
    56                 'exclude_from_search'  => false,
    57                 'publicly_queryable'    => true,
    58                 'capability_type'       => 'page',
    59                 'show_in_rest'          => true,
    60         );
    61         register_post_type( 'lesson-plan', $args );
    62 }
    63 
    64 /**
    65   * Register duration Taxonomy
    66   */
    67 public static function lesson_duration_taxonomy() {
    68 
    69         $labels = array(
    70                 'name'                       => _x( 'Duration', 'Taxonomy General Name', 'wporg_learn' ),
    71                 'singular_name'              => _x( 'Duration', 'Taxonomy Singular Name', 'wporg_learn' ),
    72                 'menu_name'                  => __( 'Duration', 'wporg_learn' ),
    73                 'all_items'                  => __( 'All Durations', 'wporg_learn' ),
    74                 'parent_item'                => __( 'Parent Duration', 'wporg_learn' ),
    75                 'parent_item_colon'          => __( 'Parent Duration:', 'wporg_learn' ),
    76                 'new_item_name'              => __( 'New Duration', 'wporg_learn' ),
    77                 'add_new_item'               => __( 'Add New Duration', 'wporg_learn' ),
    78                 'edit_item'                  => __( 'Edit Duration', 'wporg_learn' ),
    79                 'update_item'                => __( 'Update Duration', 'wporg_learn' ),
    80                 'view_item'                  => __( 'View Duration', 'wporg_learn' ),
    81                 'separate_items_with_commas' => __( 'Separate durations with commas', 'wporg_learn' ),
    82                 'add_or_remove_items'        => __( 'Add or remove durations', 'wporg_learn' ),
    83                 'choose_from_most_used'      => __( 'Choose from the most used', 'wporg_learn' ),
    84                 'popular_items'              => __( 'Popular durations', 'wporg_learn' ),
    85                 'search_items'               => __( 'Search durations', 'wporg_learn' ),
    86                 'not_found'                  => __( 'Not Found', 'wporg_learn' ),
    87                 'no_terms'                   => __( 'No durations', 'wporg_learn' ),
    88                 'items_list'                 => __( 'Durations list', 'wporg_learn' ),
    89                 'items_list_navigation'      => __( 'Durations list navigation', 'wporg_learn' ),
    90         );
    91         $args = array(
    92                 'labels'                     => $labels,
    93                 'hierarchical'               => false,
    94                 'public'                     => true,
    95                 'show_ui'                    => true,
    96                 'show_admin_column'          => true,
    97                 'show_in_nav_menus'          => false,
    98                 'show_tagcloud'              => false,
    99                 'show_in_rest'               => true,
    100         );
    101         register_taxonomy( 'duration', array( 'lesson-plan' ), $args );
    102 
    103 }
    104 
    105 /**
    106   * Register Lesson Experience Level Taxonomy
    107   */
    108 public static function lesson_level_taxonomy() {
    109 
    110         $labels = array(
    111                 'name'                       => _x( 'Experience Levels', 'Taxonomy General Name', 'wporg_learn' ),
    112                 'singular_name'              => _x( 'Experience Level', 'Taxonomy Singular Name', 'wporg_learn' ),
    113                 'menu_name'                  => __( 'Experience Level', 'wporg_learn' ),
    114                 'all_items'                  => __( 'All Experience Levels', 'wporg_learn' ),
    115                 'parent_item'                => __( 'Parent Experience Level', 'wporg_learn' ),
    116                 'parent_item_colon'          => __( 'Parent Experience Level:', 'wporg_learn' ),
    117                 'new_item_name'              => __( 'New Experience Level Name', 'wporg_learn' ),
    118                 'add_new_item'               => __( 'Add New Experience Level', 'wporg_learn' ),
    119                 'edit_item'                  => __( 'Edit Experience Level', 'wporg_learn' ),
    120                 'update_item'                => __( 'Update Experience Level', 'wporg_learn' ),
    121                 'view_item'                  => __( 'View Experience Level', 'wporg_learn' ),
    122                 'separate_items_with_commas' => __( 'Separate experience levels with commas', 'wporg_learn' ),
    123                 'add_or_remove_items'        => __( 'Add or remove experience levels', 'wporg_learn' ),
    124                 'choose_from_most_used'      => __( 'Choose from the most used', 'wporg_learn' ),
    125                 'popular_items'              => __( 'Popular Experience levels', 'wporg_learn' ),
    126                 'search_items'               => __( 'Search Experience Levels', 'wporg_learn' ),
    127                 'not_found'                  => __( 'Not Experience Found', 'wporg_learn' ),
    128                 'no_terms'                   => __( 'No experience levels', 'wporg_learn' ),
    129                 'items_list'                 => __( 'Experience Levels list', 'wporg_learn' ),
    130                 'items_list_navigation'      => __( 'Experience Levels list navigation', 'wporg_learn' ),
    131         );
    132         $args = array(
    133                 'labels'                     => $labels,
    134                 'hierarchical'               => false,
    135                 'public'                     => true,
    136                 'show_ui'                    => true,
    137                 'show_admin_column'          => true,
    138                 'show_in_nav_menus'          => true,
    139                 'show_tagcloud'              => false,
    140                 'show_in_rest'               => true,
    141         );
    142         register_taxonomy( 'level', array( 'lesson-plan' ), $args );
    143 
    144 }
    145 
    146 /**
    147   * Register Lesson Audience Taxonomy
    148   */
    149 public static function lesson_audience_taxonomy() {
    150 
    151         $labels = array(
    152                 'name'                       => _x( 'Audiences', 'Taxonomy General Name', 'wporg_learn' ),
    153                 'singular_name'              => _x( 'Audience', 'Taxonomy Singular Name', 'wporg_learn' ),
    154                 'menu_name'                  => __( 'Audience', 'wporg_learn' ),
    155                 'all_items'                  => __( 'All Audiences', 'wporg_learn' ),
    156                 'parent_item'                => __( 'Parent Audience', 'wporg_learn' ),
    157                 'parent_item_colon'          => __( 'Parent Audience:', 'wporg_learn' ),
    158                 'new_item_name'              => __( 'New Audience Name', 'wporg_learn' ),
    159                 'add_new_item'               => __( 'Add Audience', 'wporg_learn' ),
    160                 'edit_item'                  => __( 'Edit Audience', 'wporg_learn' ),
    161                 'update_item'                => __( 'Update Audience', 'wporg_learn' ),
    162                 'view_item'                  => __( 'View Audience', 'wporg_learn' ),
    163                 'separate_items_with_commas' => __( 'Separate Audiences with commas', 'wporg_learn' ),
    164                 'add_or_remove_items'        => __( 'Add or remove Audiences', 'wporg_learn' ),
    165                 'choose_from_most_used'      => __( 'Choose from the most used', 'wporg_learn' ),
    166                 'popular_items'              => __( 'Popular Audiences', 'wporg_learn' ),
    167                 'search_items'               => __( 'Search Audiences', 'wporg_learn' ),
    168                 'not_found'                  => __( 'Not Found', 'wporg_learn' ),
    169                 'no_terms'                   => __( 'No Audiences', 'wporg_learn' ),
    170                 'items_list'                 => __( 'Audiences list', 'wporg_learn' ),
    171                 'items_list_navigation'      => __( 'Audiences list navigation', 'wporg_learn' ),
    172         );
    173         $args = array(
    174                 'labels'                     => $labels,
    175                 'hierarchical'               => false,
    176                 'public'                     => true,
    177                 'show_ui'                    => true,
    178                 'show_admin_column'          => true,
    179                 'show_in_nav_menus'          => true,
    180                 'show_tagcloud'              => false,
    181                 'show_in_rest'               => true,
    182         );
    183         register_taxonomy( 'audience', array( 'lesson-plan' ), $args );
    184 
    185 }
    186 
    187 /**
    188   * Register Instruction Type Taxonomy
    189   */
    190 public static function lesson_instruction_type_taxonomy() {
    191 
    192         $labels = array(
    193                 'name'                       => _x( 'Instruction Types', 'Taxonomy General Name', 'wporg_learn' ),
    194                 'singular_name'              => _x( 'Instruction Type', 'Taxonomy Singular Name', 'wporg_learn' ),
    195                 'menu_name'                  => __( 'Instruction Type', 'wporg_learn' ),
    196                 'all_items'                  => __( 'All Instruction Types', 'wporg_learn' ),
    197                 'parent_item'                => __( 'Parent Instruction Type', 'wporg_learn' ),
    198                 'parent_item_colon'          => __( 'Parent Instruction Type:', 'wporg_learn' ),
    199                 'new_item_name'              => __( 'New Instruction Type Name', 'wporg_learn' ),
    200                 'add_new_item'               => __( 'Add Instruction Type', 'wporg_learn' ),
    201                 'edit_item'                  => __( 'Edit Instruction Type', 'wporg_learn' ),
    202                 'update_item'                => __( 'Update Instruction Type', 'wporg_learn' ),
    203                 'view_item'                  => __( 'View Instruction Type', 'wporg_learn' ),
    204                 'separate_items_with_commas' => __( 'Separate Instruction Types with commas', 'wporg_learn' ),
    205                 'add_or_remove_items'        => __( 'Add or remove Instruction Types', 'wporg_learn' ),
    206                 'choose_from_most_used'      => __( 'Choose from the most used', 'wporg_learn' ),
    207                 'popular_items'              => __( 'Popular Instruction Types', 'wporg_learn' ),
    208                 'search_items'               => __( 'Search Instruction Types', 'wporg_learn' ),
    209                 'not_found'                  => __( 'Not Found', 'wporg_learn' ),
    210                 'no_terms'                   => __( 'No Instruction Types', 'wporg_learn' ),
    211                 'items_list'                 => __( 'Instruction Types list', 'wporg_learn' ),
    212                 'items_list_navigation'      => __( 'Instruction Types list navigation', 'wporg_learn' ),
    213         );
    214         $args = array(
    215                 'labels'                     => $labels,
    216                 'hierarchical'               => false,
    217                 'public'                     => true,
    218                 'show_ui'                    => true,
    219                 'show_admin_column'          => true,
    220                 'show_in_nav_menus'          => true,
    221                 'show_tagcloud'              => false,
    222                 'show_in_rest'               => true,
    223         );
    224         register_taxonomy( 'instruction_type', array( 'lesson-plan' ), $args );
    225 
    226 }
     6        /**
     7        *  Register Lesson Plan Post Type
     8        */
     9        public static function lesson_plan_post_type() {
     10
     11                $labels = array(
     12                        'name'                  => _x( 'Lesson Plans', 'Post Type General Name', 'wporg_learn' ),
     13                        'singular_name'         => _x( 'Lesson Plan', 'Post Type Singular Name', 'wporg_learn' ),
     14                        'menu_name'             => __( 'Lesson Plans', 'wporg_learn' ),
     15                        'name_admin_bar'        => __( 'Lesson Plan', 'wporg_learn' ),
     16                        'archives'              => __( 'Lesson Archives', 'wporg_learn' ),
     17                        'attributes'            => __( 'Lesson Attributes', 'wporg_learn' ),
     18                        'parent_item_colon'     => __( 'Parent Lesson:', 'wporg_learn' ),
     19                        'all_items'             => __( 'All Lessons', 'wporg_learn' ),
     20                        'add_new_item'          => __( 'Add New Lesson', 'wporg_learn' ),
     21                        'add_new'               => __( 'Add New', 'wporg_learn' ),
     22                        'new_item'              => __( 'New Lesson Plan', 'wporg_learn' ),
     23                        'edit_item'             => __( 'Edit Lesson Plan', 'wporg_learn' ),
     24                        'update_item'           => __( 'Update Lesson Plan', 'wporg_learn' ),
     25                        'view_item'             => __( 'View Lesson', 'wporg_learn' ),
     26                        'view_items'            => __( 'View Lessons', 'wporg_learn' ),
     27                        'search_items'          => __( 'Search Lesson', 'wporg_learn' ),
     28                        'not_found'             => __( 'Not found', 'wporg_learn' ),
     29                        'not_found_in_trash'    => __( 'Not found in Trash', 'wporg_learn' ),
     30                        'featured_image'        => __( 'Featured Image', 'wporg_learn' ),
     31                        'set_featured_image'    => __( 'Set featured image', 'wporg_learn' ),
     32                        'remove_featured_image' => __( 'Remove featured image', 'wporg_learn' ),
     33                        'use_featured_image'    => __( 'Use as featured image', 'wporg_learn' ),
     34                        'insert_into_item'      => __( 'Insert into lesson', 'wporg_learn' ),
     35                        'uploaded_to_this_item' => __( 'Uploaded to this lesson', 'wporg_learn' ),
     36                        'items_list'            => __( 'Lessons list', 'wporg_learn' ),
     37                        'items_list_navigation' => __( 'Lessons list navigation', 'wporg_learn' ),
     38                        'filter_items_list'     => __( 'Filter Lessons list', 'wporg_learn' ),
     39                );
     40                $args  = array(
     41                        'label'               => __( 'Lesson Plan', 'wporg_learn' ),
     42                        'description'         => __( 'WordPress.org Training Lesson Plan', 'wporg_learn' ),
     43                        'labels'              => $labels,
     44                        'supports'            => array( 'title', 'editor', 'comments', 'revisions', 'custom-fields' ),
     45                        'taxonomies'          => array( 'duration', 'level', 'audience', 'instruction_type' ),
     46                        'hierarchical'        => true,
     47                        'public'              => true,
     48                        'show_ui'             => true,
     49                        'show_in_menu'        => true,
     50                        'menu_position'       => 5,
     51                        'menu_icon'           => 'dashicons-welcome-learn-more',
     52                        'show_in_admin_bar'   => true,
     53                        'show_in_nav_menus'   => true,
     54                        'can_export'          => true,
     55                        'has_archive'         => 'lesson-plans',
     56                        'exclude_from_search' => false,
     57                        'publicly_queryable'  => true,
     58                        'capability_type'     => 'page',
     59                        'show_in_rest'        => true,
     60                );
     61                register_post_type( 'lesson-plan', $args );
     62        }
     63
     64        /**
     65        * Register duration Taxonomy
     66        */
     67        public static function lesson_duration_taxonomy() {
     68
     69                $labels = array(
     70                        'name'                       => _x( 'Duration', 'Taxonomy General Name', 'wporg_learn' ),
     71                        'singular_name'              => _x( 'Duration', 'Taxonomy Singular Name', 'wporg_learn' ),
     72                        'menu_name'                  => __( 'Duration', 'wporg_learn' ),
     73                        'all_items'                  => __( 'All Durations', 'wporg_learn' ),
     74                        'parent_item'                => __( 'Parent Duration', 'wporg_learn' ),
     75                        'parent_item_colon'          => __( 'Parent Duration:', 'wporg_learn' ),
     76                        'new_item_name'              => __( 'New Duration', 'wporg_learn' ),
     77                        'add_new_item'               => __( 'Add New Duration', 'wporg_learn' ),
     78                        'edit_item'                  => __( 'Edit Duration', 'wporg_learn' ),
     79                        'update_item'                => __( 'Update Duration', 'wporg_learn' ),
     80                        'view_item'                  => __( 'View Duration', 'wporg_learn' ),
     81                        'separate_items_with_commas' => __( 'Separate durations with commas', 'wporg_learn' ),
     82                        'add_or_remove_items'        => __( 'Add or remove durations', 'wporg_learn' ),
     83                        'choose_from_most_used'      => __( 'Choose from the most used', 'wporg_learn' ),
     84                        'popular_items'              => __( 'Popular durations', 'wporg_learn' ),
     85                        'search_items'               => __( 'Search durations', 'wporg_learn' ),
     86                        'not_found'                  => __( 'Not Found', 'wporg_learn' ),
     87                        'no_terms'                   => __( 'No durations', 'wporg_learn' ),
     88                        'items_list'                 => __( 'Durations list', 'wporg_learn' ),
     89                        'items_list_navigation'      => __( 'Durations list navigation', 'wporg_learn' ),
     90                );
     91                $args  = array(
     92                        'labels'            => $labels,
     93                        'hierarchical'      => false,
     94                        'public'            => true,
     95                        'show_ui'           => true,
     96                        'show_admin_column' => true,
     97                        'show_in_nav_menus' => false,
     98                        'show_tagcloud'     => false,
     99                        'show_in_rest'      => true,
     100                );
     101                register_taxonomy( 'duration', array( 'lesson-plan' ), $args );
     102
     103        }
     104
     105        /**
     106        * Register Lesson Experience Level Taxonomy
     107        */
     108        public static function lesson_level_taxonomy() {
     109
     110                $labels = array(
     111                        'name'                       => _x( 'Experience Levels', 'Taxonomy General Name', 'wporg_learn' ),
     112                        'singular_name'              => _x( 'Experience Level', 'Taxonomy Singular Name', 'wporg_learn' ),
     113                        'menu_name'                  => __( 'Experience Level', 'wporg_learn' ),
     114                        'all_items'                  => __( 'All Experience Levels', 'wporg_learn' ),
     115                        'parent_item'                => __( 'Parent Experience Level', 'wporg_learn' ),
     116                        'parent_item_colon'          => __( 'Parent Experience Level:', 'wporg_learn' ),
     117                        'new_item_name'              => __( 'New Experience Level Name', 'wporg_learn' ),
     118                        'add_new_item'               => __( 'Add New Experience Level', 'wporg_learn' ),
     119                        'edit_item'                  => __( 'Edit Experience Level', 'wporg_learn' ),
     120                        'update_item'                => __( 'Update Experience Level', 'wporg_learn' ),
     121                        'view_item'                  => __( 'View Experience Level', 'wporg_learn' ),
     122                        'separate_items_with_commas' => __( 'Separate experience levels with commas', 'wporg_learn' ),
     123                        'add_or_remove_items'        => __( 'Add or remove experience levels', 'wporg_learn' ),
     124                        'choose_from_most_used'      => __( 'Choose from the most used', 'wporg_learn' ),
     125                        'popular_items'              => __( 'Popular Experience levels', 'wporg_learn' ),
     126                        'search_items'               => __( 'Search Experience Levels', 'wporg_learn' ),
     127                        'not_found'                  => __( 'Not Experience Found', 'wporg_learn' ),
     128                        'no_terms'                   => __( 'No experience levels', 'wporg_learn' ),
     129                        'items_list'                 => __( 'Experience Levels list', 'wporg_learn' ),
     130                        'items_list_navigation'      => __( 'Experience Levels list navigation', 'wporg_learn' ),
     131                );
     132                $args  = array(
     133                        'labels'            => $labels,
     134                        'hierarchical'      => false,
     135                        'public'            => true,
     136                        'show_ui'           => true,
     137                        'show_admin_column' => true,
     138                        'show_in_nav_menus' => true,
     139                        'show_tagcloud'     => false,
     140                        'show_in_rest'      => true,
     141                );
     142                register_taxonomy( 'level', array( 'lesson-plan' ), $args );
     143
     144        }
     145
     146        /**
     147        * Register Lesson Audience Taxonomy
     148        */
     149        public static function lesson_audience_taxonomy() {
     150
     151                $labels = array(
     152                        'name'                       => _x( 'Audiences', 'Taxonomy General Name', 'wporg_learn' ),
     153                        'singular_name'              => _x( 'Audience', 'Taxonomy Singular Name', 'wporg_learn' ),
     154                        'menu_name'                  => __( 'Audience', 'wporg_learn' ),
     155                        'all_items'                  => __( 'All Audiences', 'wporg_learn' ),
     156                        'parent_item'                => __( 'Parent Audience', 'wporg_learn' ),
     157                        'parent_item_colon'          => __( 'Parent Audience:', 'wporg_learn' ),
     158                        'new_item_name'              => __( 'New Audience Name', 'wporg_learn' ),
     159                        'add_new_item'               => __( 'Add Audience', 'wporg_learn' ),
     160                        'edit_item'                  => __( 'Edit Audience', 'wporg_learn' ),
     161                        'update_item'                => __( 'Update Audience', 'wporg_learn' ),
     162                        'view_item'                  => __( 'View Audience', 'wporg_learn' ),
     163                        'separate_items_with_commas' => __( 'Separate Audiences with commas', 'wporg_learn' ),
     164                        'add_or_remove_items'        => __( 'Add or remove Audiences', 'wporg_learn' ),
     165                        'choose_from_most_used'      => __( 'Choose from the most used', 'wporg_learn' ),
     166                        'popular_items'              => __( 'Popular Audiences', 'wporg_learn' ),
     167                        'search_items'               => __( 'Search Audiences', 'wporg_learn' ),
     168                        'not_found'                  => __( 'Not Found', 'wporg_learn' ),
     169                        'no_terms'                   => __( 'No Audiences', 'wporg_learn' ),
     170                        'items_list'                 => __( 'Audiences list', 'wporg_learn' ),
     171                        'items_list_navigation'      => __( 'Audiences list navigation', 'wporg_learn' ),
     172                );
     173                $args  = array(
     174                        'labels'            => $labels,
     175                        'hierarchical'      => false,
     176                        'public'            => true,
     177                        'show_ui'           => true,
     178                        'show_admin_column' => true,
     179                        'show_in_nav_menus' => true,
     180                        'show_tagcloud'     => false,
     181                        'show_in_rest'      => true,
     182                );
     183                register_taxonomy( 'audience', array( 'lesson-plan' ), $args );
     184
     185        }
     186
     187        /**
     188        * Register Instruction Type Taxonomy
     189        */
     190        public static function lesson_instruction_type_taxonomy() {
     191
     192                $labels = array(
     193                        'name'                       => _x( 'Instruction Types', 'Taxonomy General Name', 'wporg_learn' ),
     194                        'singular_name'              => _x( 'Instruction Type', 'Taxonomy Singular Name', 'wporg_learn' ),
     195                        'menu_name'                  => __( 'Instruction Type', 'wporg_learn' ),
     196                        'all_items'                  => __( 'All Instruction Types', 'wporg_learn' ),
     197                        'parent_item'                => __( 'Parent Instruction Type', 'wporg_learn' ),
     198                        'parent_item_colon'          => __( 'Parent Instruction Type:', 'wporg_learn' ),
     199                        'new_item_name'              => __( 'New Instruction Type Name', 'wporg_learn' ),
     200                        'add_new_item'               => __( 'Add Instruction Type', 'wporg_learn' ),
     201                        'edit_item'                  => __( 'Edit Instruction Type', 'wporg_learn' ),
     202                        'update_item'                => __( 'Update Instruction Type', 'wporg_learn' ),
     203                        'view_item'                  => __( 'View Instruction Type', 'wporg_learn' ),
     204                        'separate_items_with_commas' => __( 'Separate Instruction Types with commas', 'wporg_learn' ),
     205                        'add_or_remove_items'        => __( 'Add or remove Instruction Types', 'wporg_learn' ),
     206                        'choose_from_most_used'      => __( 'Choose from the most used', 'wporg_learn' ),
     207                        'popular_items'              => __( 'Popular Instruction Types', 'wporg_learn' ),
     208                        'search_items'               => __( 'Search Instruction Types', 'wporg_learn' ),
     209                        'not_found'                  => __( 'Not Found', 'wporg_learn' ),
     210                        'no_terms'                   => __( 'No Instruction Types', 'wporg_learn' ),
     211                        'items_list'                 => __( 'Instruction Types list', 'wporg_learn' ),
     212                        'items_list_navigation'      => __( 'Instruction Types list navigation', 'wporg_learn' ),
     213                );
     214                $args  = array(
     215                        'labels'            => $labels,
     216                        'hierarchical'      => false,
     217                        'public'            => true,
     218                        'show_ui'           => true,
     219                        'show_admin_column' => true,
     220                        'show_in_nav_menus' => true,
     221                        'show_tagcloud'     => false,
     222                        'show_in_rest'      => true,
     223                );
     224                register_taxonomy( 'instruction_type', array( 'lesson-plan' ), $args );
     225
     226        }
    227227
    228228        /**
     
    230230         */
    231231        public static function filter_the_title_edit_link( $title, $id = null ) {
    232                 // Only apply to the main title for the document
     232                // Only apply to the main title for the document.
    233233                if ( ! is_singular( 'lesson_plan' )
    234234                        || ! is_main_query()
    235235                        || ! in_the_loop()
    236236                        || is_embed()
    237                         || $id !== get_queried_object_id() ) {
     237                        || get_queried_object_id() !== $id ) {
    238238                        return $title;
    239239                }
     
    306306                 */
    307307                $edit_action = array(
    308                         'action' => 'edit',
    309                         'href' => $markdown_source,
    310                         'classes' => array( 'edit-post-link' ),
    311                         'rel' => $post_id,
    312                         'initialState' => 'default'
     308                        'action'       => 'edit',
     309                        'href'         => $markdown_source,
     310                        'classes'      => array( 'edit-post-link' ),
     311                        'rel'          => $post_id,
     312                        'initialState' => 'default',
    313313                );
    314314
    315315                // Find and replace the existing edit action.
    316316                $replaced = false;
    317                 foreach( $actions as &$action ) {
     317                foreach ( $actions as &$action ) {
    318318                        if ( 'edit' === $action['action'] ) {
    319                                 $action = $edit_action;
     319                                $action   = $edit_action;
    320320                                $replaced = true;
    321321                                break;
     
    341341                        return $markdown_source;
    342342                }
    343                 $markdown_source = str_replace( '/lesson-plan', '', $markdown_source);
    344                 $markdown_source = str_replace( 'wptrainingteam.github.io', 'github.com/wptrainingteam', $markdown_source);
     343                $markdown_source = str_replace( '/lesson-plan', '', $markdown_source );
     344                $markdown_source = str_replace( 'wptrainingteam.github.io', 'github.com/wptrainingteam', $markdown_source );
    345345                $markdown_source = str_replace( '/README.md', '/edit/dev/README.md', $markdown_source );
    346346                return $markdown_source;
    347347        }
    348348
    349   public static function replace_image_links( $content ) {
    350     $post_id = get_the_ID();
    351     $markdown_source = Markdown_Import::get_markdown_source( $post_id );
    352     if ( is_wp_error( $markdown_source ) ) {
    353       return $content;
    354     }
    355     $markdown_source = str_replace( '/README.md', '', $markdown_source );
    356     $content = str_replace( '<img src="/images/', '<img src="' . $markdown_source . '/images/', $content );
    357 
    358     return $content;
    359   }
     349        public static function replace_image_links( $content ) {
     350                $post_id        = get_the_ID();
     351                $markdown_source = Markdown_Import::get_markdown_source( $post_id );
     352                if ( is_wp_error( $markdown_source ) ) {
     353                        return $content;
     354                }
     355                $markdown_source = str_replace( '/README.md', '', $markdown_source );
     356                $content        = str_replace( '<img src="/images/', '<img src="' . $markdown_source . '/images/', $content );
     357
     358                return $content;
     359        }
    360360}
Note: See TracChangeset for help on using the changeset viewer.