Skip to content

Commit 1d0f69d

Browse files
committed
WDSBT-23 - Adjust related posts pattern and styles
1 parent 481f182 commit 1d0f69d

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed

assets/scss/patterns/_index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
// 'patterns/' houses styles for custom patterns.
22
// @import './pattern-name';
3+
@import './related-posts';
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/** cards **/
2+
3+
.related-posts-query {
4+
5+
.wp-block-post {
6+
border-radius: 10px;
7+
box-shadow: 0 8px 16px 0 rgba(48, 49, 51, 0.1), 0 0 1px 0 rgba(48, 49, 51, 0.05);
8+
9+
> *:not(.wp-block-post-featured-image):not(hr) {
10+
padding: 0.5rem 1.875rem;
11+
}
12+
13+
.wp-block-post-featured-image {
14+
border-top-left-radius: 10px;
15+
}
16+
17+
.wp-block-post-terms {
18+
padding-bottom: 0;
19+
20+
a {
21+
color: var(--wp--preset--color--grey-400);
22+
padding-bottom: 0;
23+
text-transform: none;
24+
25+
&:hover,
26+
&:focus {
27+
color: var(--wp--preset--color--primary-500);
28+
}
29+
}
30+
31+
}
32+
33+
.wp-block-post-title {
34+
margin: 0;
35+
36+
a {
37+
color: var(--wp--preset--color--black);
38+
font-size: var(--wp--preset--font-size--l);
39+
line-height: 1.3;
40+
41+
&:hover,
42+
&:focus {
43+
color: var(--wp--preset--color--primary-500);
44+
}
45+
}
46+
}
47+
48+
hr {
49+
border-top: 1px;
50+
margin: 0;
51+
}
52+
53+
.wp-block-post-excerpt {
54+
color: var(--wp--preset--color--grey-500);
55+
margin-top: 0;
56+
padding: 0 0 1.25rem 0;
57+
}
58+
59+
.wp-block-read-more {
60+
color: var(--wp--preset--color--primary-500);
61+
font-size: var(--wp--preset--font-size--xxs);
62+
font-weight: 300;
63+
margin-bottom: 0.75rem;
64+
margin-top: 0.75rem;
65+
text-decoration: underline;
66+
67+
&:hover,
68+
&:focus {
69+
color: var(--wp--preset--color--primary-300);
70+
}
71+
}
72+
}
73+
}

inc/hooks/register-block-patterns.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function register_custom_block_pattern() {
2020
'templateTypes' => array( 'single-post' ),
2121
'postTypes' => array( '' ),
2222
'description' => _x( 'Related Posts query variation', 'Block pattern description', 'wdsbt' ),
23-
'content' => "<!-- wp:group {\"tagName\":\"aside\",\"metadata\":{\"name\":\"Recent Posts\"},\"style\":{\"spacing\":{\"margin\":{\"top\":\"var:preset|spacing|40\"},\"padding\":{\"bottom\":\"var:preset|spacing|50\"}}},\"layout\":{\"type\":\"constrained\"}} -->\n<aside class=\"wp-block-group\" style=\"margin-top:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--50)\"><!-- wp:query {\"queryId\":0,\"query\":{\"perPage\":10,\"pages\":0,\"offset\":0,\"postType\":\"post\",\"order\":\"desc\",\"orderBy\":\"date\",\"author\":\"\",\"search\":\"\",\"exclude\":[],\"sticky\":\"\",\"inherit\":true,\"taxQuery\":null,\"parents\":[]}} -->\n<div class=\"wp-block-query\"><!-- wp:post-template {\"className\":\"related-posts-query\",\"layout\":{\"type\":\"grid\",\"columnCount\":3}} -->\n<!-- wp:post-featured-image {\"isLink\":true} /-->\n\n<!-- wp:post-terms {\"term\":\"category\"} /-->\n\n<!-- wp:post-title {\"isLink\":true,\"fontSize\":\"small\"} /-->\n\n<!-- wp:read-more {\"content\":\"\"} /-->\n<!-- /wp:post-template --></div>\n<!-- /wp:query --></aside>\n<!-- /wp:group -->",
23+
'content' => "<!-- wp:group {\"className\":\"related-posts\",\"tagName\":\"aside\",\"metadata\":{\"name\":\"Recent Posts\"},\"style\":{\"spacing\":{\"margin\":{\"top\":\"var:preset|spacing|40\"},\"padding\":{\"bottom\":\"var:preset|spacing|50\"}}},\"layout\":{\"type\":\"constrained\"}} -->\n<aside class=\"wp-block-group\" style=\"margin-top:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--50)\"><!-- wp:query {\"queryId\":0,\"query\":{\"perPage\":10,\"pages\":0,\"offset\":0,\"postType\":\"post\",\"order\":\"desc\",\"orderBy\":\"date\",\"author\":\"\",\"search\":\"\",\"exclude\":[],\"sticky\":\"\",\"inherit\":true,\"taxQuery\":null,\"parents\":[]}} -->\n<div class=\"wp-block-query\"><!-- wp:post-template {\"className\":\"related-posts-query is-style-shadow-light\",\"layout\":{\"type\":\"grid\",\"columnCount\":3}} -->\n<!-- wp:post-featured-image {\"aspectRatio\":\"16/9\",\"isLink\":true} /-->\n\n<!-- wp:group {\"className\":\"query-content\",\"layout\":{\"type\":\"constrained\"}} -->\n\n<!-- wp:post-terms {\"term\":\"category\"} /-->\n\n<!-- wp:post-title {\"isLink\":true,\"fontSize\":\"small\"} /-->\n\n<!-- wp:post-excerpt {\"excerptLength\":20} /-->\n\n<hr /><!-- wp:read-more {} /-->\n<!-- /wp:post-template --></div>\n<!-- /wp:query --></aside>\n<!-- /wp:group -->",
2424
)
2525
);
2626
}

0 commit comments

Comments
 (0)