Skip to content

Commit 00275c4

Browse files
committed
WDSBT-23 - Transfer related posts pattern registration
1 parent 4b1c299 commit 00275c4

File tree

2 files changed

+26
-33
lines changed

2 files changed

+26
-33
lines changed

inc/hooks/register-block-patterns.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Registers custom block pattern categories for the WDS BT theme.
4+
*
5+
* @package wdsbt
6+
*/
7+
8+
namespace WebDevStudios\wdsbt;
9+
10+
/**
11+
* Registers custom block pattern for the WDS BT theme.
12+
*/
13+
function register_custom_block_pattern() {
14+
15+
register_block_pattern(
16+
'wdsbt/related-posts',
17+
array(
18+
'title' => __( 'Related Posts', 'wdsbt' ),
19+
'blockTypes' => array( 'core/query' ),
20+
'templateTypes' => array( 'single-post' ),
21+
'description' => _x( 'Related Posts query variation', 'Block pattern description', 'wdsbt' ),
22+
'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+
)
24+
);
25+
}
26+
add_action( 'init', __NAMESPACE__ . '\register_custom_block_pattern', 9 );

patterns/related-posts.php

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)