Making WordPress.org


Ignore:
Timestamp:
10/13/2020 11:55:05 PM (6 years ago)
Author:
coreymckrill
Message:

WordPress.org Learn: Sync with GitHub

https://github.com/WordPress/learn/compare/348e99fc763e9bd460a6446b2484312e6e5e68db...116a8706331ea044839d22347433f98af8ab8ccb

File:
1 edited

Legend:

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

    r10339 r10376  
    117117    );
    118118
    119     $template = array(
    120         array(
    121             'core-embed/wordpress-tv',
    122             array( 'className' => 'workshop-page_video' ),
    123         ),
    124         array(
    125             'core/columns',
    126             array( 'className' => 'workshop-page_content' ),
    127             array(
    128                 array(
    129                     'core/column',
    130                     array( 'width' => 66.66 ),
    131                     array(
    132                         array(
    133                             'core/paragraph',
    134                             array(
    135                                 'placeholder' => __( 'Describe what the workshop is about.', 'wporg-learn' ),
    136                             ),
    137                         ),
    138                         array(
    139                             'core/heading',
    140                             array(
    141                                 'level'   => '2',
    142                                 'content' => __( 'Learning outcomes', 'wporg-learn' ),
    143                             ),
    144                         ),
    145                         array(
    146                             'core/list',
    147                             array(
    148                                 'className' => 'workshop-page_list',
    149                                 'ordered'   => true,
    150                             ),
    151                         ),
    152                         array(
    153                             'core/heading',
    154                             array(
    155                                 'level'   => '2',
    156                                 'content' => __( 'Comprehension questions', 'wporg-learn' ),
    157                             ),
    158                         ),
    159                         array(
    160                             'core/list',
    161                             array(
    162                                 'className' => 'workshop-page_list',
    163                             ),
    164                         ),
    165                     ),
    166                 ), // End column block.
    167                 array(
    168                     'core/column',
    169                     array(
    170                         'className' => 'workshop-page_sidebar',
    171                         'width'     => 33.333,
    172                     ),
    173                     array(
    174                         array( 'wporg-learn/workshop-details' ),
    175                         array(
    176                             'core/button',
    177                             array(
    178                                 'className'    => 'is-style-secondary-full-width',
    179                                 'text'         => __( 'Join a Group Discussion', 'wporg-learn' ),
    180                                 'url'          => 'https://www.meetup.com/learn-wordpress-discussions/events/',
    181                                 'borderRadius' => 5,
    182                             ),
    183                         ),
    184                         array(
    185                             'core/paragraph',
    186                             array(
    187                                 'className' => 'terms',
    188                                 'content'   => sprintf(
    189                                     __( 'You must agree to our <a href="%s">Code of Conduct</a> in order to participate.', 'wporg-learn' ),
    190                                     'https://learn.wordpress.org/code-of-conduct/'
    191                                 ),
    192                             ),
    193                         ),
    194                     ),
    195                 ), // End column block.
    196             ),
    197         ), // End columns block.
    198         array( 'core/separator' ),
    199     );
    200 
    201119    $args = array(
    202120        'label'               => __( 'Workshop', 'wporg_learn' ),
     
    204122        'labels'              => $labels,
    205123        'supports'            => array( 'title', 'editor', 'comments', 'revisions', 'custom-fields', 'thumbnail', 'excerpt' ),
    206         'taxonomies'          => array( 'level', 'topic' ),
     124        'taxonomies'          => array( 'topic' ),
    207125        'hierarchical'        => true,
    208126        'public'              => true,
     
    221139        'template_lock'       => 'all',
    222140        'rewrite'             => array( 'slug' => 'workshop' ),
    223         'template'            => $template,
     141        'template'            => generate_workshop_template_structure(),
    224142    );
    225143
    226144    register_post_type( 'wporg_workshop', $args );
     145}
     146
     147/**
     148 * Create an array representation of a workshop's content template.
     149 *
     150 * Note that if this template structure changes, the content in views/content-workshop.php
     151 * will also need to be updated.
     152 *
     153 * @return array
     154 */
     155function generate_workshop_template_structure() {
     156    $template = array(
     157        array(
     158            'core-embed/wordpress-tv',
     159            array( 'className' => 'workshop-page_video' ),
     160        ),
     161        array(
     162            'core/columns',
     163            array( 'className' => 'workshop-page_content' ),
     164            array(
     165                array(
     166                    'core/column',
     167                    array( 'width' => 66.66 ),
     168                    array(
     169                        array(
     170                            'core/paragraph',
     171                            array(
     172                                'placeholder' => __( 'Describe what the workshop is about.', 'wporg-learn' ),
     173                            ),
     174                        ),
     175                        array(
     176                            'core/heading',
     177                            array(
     178                                'level'   => '2',
     179                                'content' => __( 'Learning outcomes', 'wporg-learn' ),
     180                            ),
     181                        ),
     182                        array(
     183                            'core/list',
     184                            array(
     185                                'className' => 'workshop-page_list',
     186                                'ordered'   => true,
     187                            ),
     188                        ),
     189                        array(
     190                            'core/heading',
     191                            array(
     192                                'level'   => '2',
     193                                'content' => __( 'Comprehension questions', 'wporg-learn' ),
     194                            ),
     195                        ),
     196                        array(
     197                            'core/list',
     198                            array(
     199                                'className' => 'workshop-page_list',
     200                            ),
     201                        ),
     202                    ),
     203                ), // End column block.
     204                array(
     205                    'core/column',
     206                    array(
     207                        'className' => 'workshop-page_sidebar',
     208                        'width'     => 33.333,
     209                    ),
     210                    array(
     211                        array( 'wporg-learn/workshop-details' ),
     212                        array(
     213                            'core/button',
     214                            array(
     215                                'className'    => 'is-style-secondary-full-width',
     216                                'text'         => __( 'Join a Group Discussion', 'wporg-learn' ),
     217                                'url'          => 'https://www.meetup.com/learn-wordpress-discussions/events/',
     218                                'borderRadius' => 5,
     219                            ),
     220                        ),
     221                        array(
     222                            'core/paragraph',
     223                            array(
     224                                'className' => 'terms',
     225                                'content'   => sprintf(
     226                                    __( 'You must agree to our <a href="%s">Code of Conduct</a> in order to participate.', 'wporg-learn' ),
     227                                    'https://learn.wordpress.org/code-of-conduct/'
     228                                ),
     229                            ),
     230                        ),
     231                    ),
     232                ), // End column block.
     233            ),
     234        ), // End columns block.
     235        array( 'core/separator' ),
     236    );
     237
     238    return $template;
    227239}
    228240
Note: See TracChangeset for help on using the changeset viewer.