Skip to content

Commit

Permalink
WDSBT-23 - Transfer related posts pattern registration
Browse files Browse the repository at this point in the history
  • Loading branch information
khleomix committed Jun 19, 2024
1 parent 4b1c299 commit 00275c4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 33 deletions.
26 changes: 26 additions & 0 deletions inc/hooks/register-block-patterns.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Registers custom block pattern categories for the WDS BT theme.
*
* @package wdsbt
*/

namespace WebDevStudios\wdsbt;

/**
* Registers custom block pattern for the WDS BT theme.
*/
function register_custom_block_pattern() {

register_block_pattern(
'wdsbt/related-posts',
array(
'title' => __( 'Related Posts', 'wdsbt' ),
'blockTypes' => array( 'core/query' ),
'templateTypes' => array( 'single-post' ),
'description' => _x( 'Related Posts query variation', 'Block pattern description', 'wdsbt' ),
'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 -->",
)
);
}
add_action( 'init', __NAMESPACE__ . '\register_custom_block_pattern', 9 );
33 changes: 0 additions & 33 deletions patterns/related-posts.php

This file was deleted.

0 comments on commit 00275c4

Please sign in to comment.