Skip to content

Commit

Permalink
Workshops: Adjust block template to accommodate excerpt generation
Browse files Browse the repository at this point in the history
This removes all of the `core/group` blocks from the template and
reassigns their custom class names to the wrapping column blocks or
inner blocks where appropriate. A little bit of additional styling
was necessary to ensure the layout remains the same for both the old
and new markup.

With no group blocks in the mix, excerpts will now be automatically
generated for workshop posts.

Fixes #46
  • Loading branch information
coreymckrill committed Sep 24, 2020
1 parent 630d271 commit a5264ab
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 80 deletions.
153 changes: 77 additions & 76 deletions wp-content/plugins/wporg-learn/inc/post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,61 +114,86 @@ function register_workshop() {
'filter_items_list' => __( 'Filter Workshops list', 'wporg_learn' ),
);

$video_template_part = array( 'core/group',
array( 'className' => 'workshop-page_video' ),
array( array( 'core-embed/wordpress-tv' ) ),
);

$outcome_template_part = array( 'core/group',
array( 'className' => 'workshop-page_list' ),
$template = array(
array(
array( 'core/heading', array(
'level' => '2',
'content' => __( 'Learning outcomes', 'wporg-learn' ),
),
),
array( 'core/list', array(
'ordered' => true,
),
'core-embed/wordpress-tv',
array( 'className' => 'workshop-page_video' ),
),
),
);

$comprehension_template_part = array( 'core/group',
array( 'className' => 'workshop-page_list' ),
array(
array( 'core/heading', array(
'level' => '2',
'content' => __( 'Comprehension questions', 'wporg-learn' ),
),
),
array( 'core/list', array(
'ordered' => true,
),
),
),
);

$sidebar_template_part = array( 'core/group',
array( 'className' => 'workshop-page_sidebar' ),
array(
array( 'wporg-learn/workshop-details' ),
array( 'core/button', array(
'text' => __( 'Join a Group Discussion', 'wporg-learn' ),
'url' => 'https://www.meetup.com/learn-wordpress-discussions/events/',
'borderRadius' => 5,
'className' => 'is-style-secondary-full-width',
),
),
array( 'core/paragraph', array(
'className' => 'terms',
'content' => sprintf(
__( 'You must agree to our <a href="%s">Code of Conduct</a> in order to participate.', 'wporg-learn' ),
'https://learn.wordpress.org/code-of-conduct/'
),
'core/columns',
array( 'className' => 'workshop-page_content' ),
array(
array(
'core/column',
array( 'width' => 66.66 ),
array(
array(
'core/paragraph',
array(
'placeholder' => __( 'Describe what the workshop is about.', 'wporg-learn' ),
),
),
array(
'core/heading',
array(
'level' => '2',
'content' => __( 'Learning outcomes', 'wporg-learn' ),
),
),
array(
'core/list',
array(
'className' => 'workshop-page_list',
'ordered' => true,
),
),
array(
'core/heading',
array(
'level' => '2',
'content' => __( 'Comprehension questions', 'wporg-learn' ),
),
),
array(
'core/list',
array(
'className' => 'workshop-page_list',
),
),
),
), // End column block.
array(
'core/column',
array(
'className' => 'workshop-page_sidebar',
'width' => 33.333,
),
array(
array( 'wporg-learn/workshop-details' ),
array(
'core/button',
array(
'className' => 'is-style-secondary-full-width',
'text' => __( 'Join a Group Discussion', 'wporg-learn' ),
'url' => 'https://www.meetup.com/learn-wordpress-discussions/events/',
'borderRadius' => 5,
),
),
array(
'core/paragraph',
array(
'className' => 'terms',
'content' => sprintf(
__( 'You must agree to our <a href="%s">Code of Conduct</a> in order to participate.', 'wporg-learn' ),
'https://learn.wordpress.org/code-of-conduct/'
),
),
),
),
), // End column block.
),
),
),
), // End columns block.
array( 'core/separator' ),
);

$args = array(
Expand All @@ -193,31 +218,7 @@ function register_workshop() {
'show_in_rest' => true,
'template_lock' => 'all',
'rewrite' => array( 'slug' => 'workshop' ),
'template' => array(
array( 'core/group',
array( 'className' => 'workshop-page_content' ),
array(
$video_template_part,
array( 'core/columns', array(), array(
array( 'core/column', array( 'width' => 66.66 ), array(
array( 'core/paragraph', array(
'placeholder' => __( 'Describe what the workshop is about', 'wporg-learn' ),
),
),
$outcome_template_part,
$comprehension_template_part,
),
),
array( 'core/column', array( 'width' => 33.333 ), array(
$sidebar_template_part,
),
),
),
),
),
),
array( 'core/separator', array() ),
),
'template' => $template,
);

register_post_type( 'wporg_workshop', $args );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
}

&_video {
// This markup is provided by gutenberg
figure {
&,
& figure { // Back compat.
margin: $gutter-default * 2 0;
}

Expand Down
2 changes: 1 addition & 1 deletion wp-content/themes/pub/wporg-learn-2020/css/style.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion wp-content/themes/pub/wporg-learn-2020/css/style.css.map

Large diffs are not rendered by default.

0 comments on commit a5264ab

Please sign in to comment.