This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp.blocks.registerBlockVariation( 'core/query', { | |
name: SIMPLE_QUERY, | |
title: 'Simple Query', | |
description: 'Displays a Simple Query', | |
return ( | |
namespace === SIMPLE_QUERY | |
&& query.postType === 'post' | |
); | |
}, | |
icon: 'edit-large', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Order by last word in title. | |
* | |
* @param string $orderby orderby | |
* @param object $query data | |
* | |
* @link https://wordpress.stackexchange.com/questions/1003/order-posts-by-last-word-in-title | |
* | |
* @return string | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SIMPLE_QUERY = `loop-patterns/simple-query` | |
wp.domReady( function() { | |
wp.blocks.registerBlockVariation( 'core/query', {} ) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd loop-patterns | |
// cd to the src folder and create 2 directories | |
cd src && mkdir css simple-query | |
// cd into our first variation dir and create index.js | |
cd simple-query && touch index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.home { | |
overflow-x: hidden; | |
} | |
.home header { | |
position: absolute; | |
width: calc(100% - 32px); | |
padding: 16px; | |
z-index: 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Title: Call to Action | |
* Slug: my-theme/call-to-action | |
* Block types: core/post-content | |
* Categories: featured, text | |
*/ | |
?> | |
<!-- wp:cover {"overlayColor":"secondary","minHeight":307,"minHeightUnit":"px","style":{"spacing":{"padding":{"top":"32px","right":"32px","bottom":"32px","left":"32px"}}}} --> | |
<div class="wp-block-cover" style="padding-top:32px;padding-right:32px;padding-bottom:32px;padding-left:32px;min-height:307px"><span aria-hidden="true" class="wp-block-cover__background has-secondary-background-color has-background-dim-100 has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:group {"layout":{"contentSize":"800px"}} --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Title: Latest Posts | |
* Slug: my-theme/latest-posts | |
* Block types: core/post-content | |
* Categories: featured, text | |
*/ | |
?> | |
<!-- wp:query {"queryId":0,"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false},"displayLayout":{"type":"flex","columns":3},"layout":{"contentSize":"800px"}} --> | |
<div class="wp-block-query"><!-- wp:post-template --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 2, | |
// e.g. https://wordpress.org/patterns/pattern/meet-the-team-2/ | |
"patterns": [ "meet-the-team-2" ] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Title: Hero | |
* Slug: my-theme/hero | |
* Block types: core/post-content | |
* Categories: headers, text | |
*/ | |
?> | |
<!-- wp:cover {"url":"http://fsefidelitas.local/wp-content/uploads/2022/06/marta-rastovac-t0m-hgapGk-unsplash-scaled.jpeg","id":21,"dimRatio":50,"minHeight":600,"style":{"spacing":{"padding":{"top":"100px","right":"200px","bottom":"100px","left":"200px"}}}} --> | |
<div class="wp-block-cover" style="padding-top:100px;padding-right:200px;padding-bottom:100px;padding-left:200px;min-height:600px"><span aria-hidden="true" class="wp-block-cover__background has-background-dim"></span><img class="wp-block-cover__image-background wp-image-21" alt="" src="http://fsefidelitas.local/wp-content/uploads/2022/06/marta-rastovac-t0m-hgapGk-unsplash-scaled.jpeg" data-object-fit="cover"/><div class="wp-block-cover__inner-container"><!-- wp:group {"layout":{"contentSize":"600px"}} --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"styles":{ | |
"blocks": { | |
"core/button": { | |
"spacing": { | |
"padding": { | |
"top": "16px", | |
"right": "32px", | |
"bottom": "16px", | |
"left": "32px" | |
} |