Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 🎉 UCSC Grid Query Loop pattern #342

Closed
wants to merge 9 commits into from
4 changes: 4 additions & 0 deletions lib/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@
'grid',
array( 'label' => __( 'Grid', 'ucsc' ) )
);
register_block_pattern_category(
'query_loop',
array( 'label' => __( 'Query Loop', 'ucsc' ) )
);
} );
2 changes: 1 addition & 1 deletion patterns/post-query-card.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Title: Query Loop Card
* Slug: ucsc-2022/query-loop-card
* Block Types: core/post-title, core/featured-image, core/post-date, core/post-excerpt
* Categories: text_layout
* Categories: text_layout query_loop
*/
?>
<!-- wp:group {"className":"ucsc__card ucsc__card\u002d\u002dquery-loop","layout":{"type":"default"}} -->
Expand Down
25 changes: 25 additions & 0 deletions patterns/query-loop-grid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* Title: UCSC Grid
* Slug: ucsc-2022/query-loop-grid
* Block Types: core/query
* Categories: query_loop
*/

?>
<!-- wp:query -->
<div class="wp-block-query"><!-- wp:post-template {"layout":{"type":"grid","columnCount":3}} -->
<!-- wp:group {"className":"ucsc__card ucsc__card\u002d\u002dquery-loop","layout":{"type":"default"}} -->
<div class="wp-block-group ucsc__card ucsc__card--query-loop"><!-- wp:post-featured-image {"isLink":true,"width":"","height":"","sizeSlug":"sixteen-nine","className":"ucsc-query-loop__image"} /-->

<!-- wp:post-terms {"term":"category","style":{"elements":{"link":{"color":{"text":"var:preset|color|ucsc-secondary-blue"},":hover":{"color":{"text":"var:preset|color|ucsc-primary-blue"}}}}},"textColor":"black","className":"ucsc-query-loop__category","fontSize":"small"} /-->

<!-- wp:post-title {"isLink":true,"style":{"elements":{"link":{"color":{"text":"var:preset|color|ucsc-secondary-blue"},":hover":{"color":{"text":"var:preset|color|ucsc-primary-blue"}}}}},"fontSize":"three"} /-->

<!-- wp:post-date {"style":{"spacing":{"margin":{"bottom":"0"}}},"textColor":"black","className":"ucsc-query-loop__post-date","fontSize":"base"} /-->

<!-- wp:post-excerpt {"className":"ucsc-query-loop__excerpt"} /--></div>
<!-- /wp:group -->
<!-- /wp:post-template --></div>
<!-- /wp:query -->

12 changes: 12 additions & 0 deletions src/scss/block-patterns/_cards.scss
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,15 @@
}
}
}

/* Hide placeholder in editor */
.editor-styles-wrapper .ucsc__card--query-loop {

&:not(&:has(figure)) {

&::before {
content: "";
display: none;
}
}
}