Skip to content

Instantly share code, notes, and snippets.

@farukgaric
Last active August 27, 2020 23:02
Show Gist options
  • Save farukgaric/3ca72f669a7f48bd83300e4eb8ce2bb3 to your computer and use it in GitHub Desktop.
Save farukgaric/3ca72f669a7f48bd83300e4eb8ce2bb3 to your computer and use it in GitHub Desktop.
WordPress Block Patterns - Listicle
/**
* Plugin Name: FG Patterns
* Plugin URI: https://www.farukgaric.com/
* Description: Various block patterns
* Version: 1.0.0
* Author: Faruk Garic
* Author URI: https://www.farukgaric.com/
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: fg-patterns
*/
function fg_patterns_register_block_patterns() {
register_block_pattern(
'fg-patterns/listicle',
array(
'title' => __( 'Listicle', 'fg-patterns' ),
'description' => _x( 'A piece of writing or other content presented wholly or partly in the form of a list.', 'Block pattern description', 'fg-patterns' ),
'categories' => array( 'text' ),
'content' => "<!-- wp:group --><div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<!-- wp:heading {\"textColor\":\"black\",\"fontSize\":\"large\"} -->\n<h2 class=\"has-black-color has-text-color has-large-font-size\"><span style=\"color:#ba0c49\" class=\"has-inline-color\"><strong>1</strong>.</span><br>Which treats of the first sally the ingenious Don Quixote made from home</h2>\n
<!-- /wp:heading -->\n<!-- wp:image {\"id\":3848,\"sizeSlug\":\"large\"} -->\n<figure class=\"wp-block-image size-large\"><img src=\"https://www.farukgaric.com/wp-content/uploads/2020/08/hannah-grace-j9JoYpaJH3A-unsplash-edited-scaled.jpg\" alt=\"quote\" class=\"wp-image-3848\"/></figure>\n<!-- /wp:image -->\n<!-- wp:paragraph {\"textColor\":\"black\"} -->\n<p class=\"has-black-color has-text-color\">These preliminaries settled, he did not care to put off any longer the execution of his design, urged on to it by the thought of all the world was losing by his delay, seeing what wrongs he intended to right, grievances to redress, injustices to repair, abuses to remove, and duties to discharge.</p>\n<!-- /wp:paragraph -->\n</div></div>\n<!-- /wp:group -->",
)
);
}
add_action( 'init', 'fg_patterns_register_block_patterns' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment