Skip to content

Instantly share code, notes, and snippets.

@johnnya23
johnnya23 / pattern.php
Created September 12, 2021 21:48
sample pattern code (
<?php
function tabor_register_block_patterns() {
if ( class_exists( 'WP_Block_Patterns_Registry' ) ) {
// $content >>>>> COPY AND PAST FROM LIVE SITE
$content = '<!-- wp:heading {\"align\":\"center\"} -->\n<h2 class=\"has-text-align-center\"><strong>Our approach reflects the people we serve. We are diverse, yet the same.</strong></h2>\n<!-- /wp:heading -->\n\n<!-- wp:buttons {\"align\":\"center\"} -->\n<div class=\"wp-block-buttons aligncenter\"><!-- wp:button {\"borderRadius\":7,\"style\":{\"color\":{\"gradient\":\"linear-gradient(135deg,rgb(0,0,0) 0%,rgb(0,0,0) 50%,rgb(0,0,0) 100%)\"}}} -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-background\" style=\"border-radius:7px;background:linear-gradient(135deg,rgb(0,0,0) 0%,rgb(0,0,0) 50%,rgb(0,0,0) 100%)\">Learn More</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons -->\n\n<!-- wp:spacer {\"height\":59} -->\n<div style=\"height:59px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer -->\n\n<!
<?php
/**
* Add Read More button below post excerpts/content on archives.
*/
function jma_child_read_more()
{
// only if this is not a singular page.
if (!is_singular()) {
printf('<a href="%s" class="more-link button">%s</a>', get_permalink(), esc_html__('Continue Reading'));
}