Skip to content

Commit

Permalink
Merge pull request #86 from Codeinwp/Add-Global-text-strings
Browse files Browse the repository at this point in the history
Define text strings in core.php
  • Loading branch information
JohnPixle authored Dec 5, 2023
2 parents a5e60da + 884e74c commit ea20f44
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 0 deletions.
31 changes: 31 additions & 0 deletions inc/Block_Patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,37 @@ private function setup_properties() {
'pricing-plans-inline-title',
'team',
'testimonial-columns',

/* new patterns */

'features-centered',
'feature-cards',
'features-background',
'hero-columns',
'hero-boxed',
'title-button',
'title-background',
'testimonial-background',
'testimonial-columns',
'testimonial-fullwidth',
'testimonial-cards',
'pricing-5',
'pricing-4',
'pricing-3',
'loop-card-centered',
'loop-cards',
'loop-rows',
'loop-3',
'call-to-action-image',
'call-to-action-4',
'team-columns',
'team-grid',
'team-rows',
'single-post-2',
'single-post-3',
'single-post-cover',
'homepage-2',
'homepage -3',
);

$this->categories = apply_filters( 'raft_block_patterns_categories', $categories );
Expand Down
55 changes: 55 additions & 0 deletions inc/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ private function run_hooks() {
add_action( 'after_setup_theme', array( $this, 'setup' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue' ) );
add_action( 'enqueue_block_editor_assets', array( $this, 'add_editor_styles' ) );
add_filter( 'raft_strings', array( $this, 'strings' ) );
}

/**
Expand Down Expand Up @@ -108,4 +109,58 @@ public function enqueue() {
public function add_editor_styles() {
Assets_Manager::enqueue_style( Assets_Manager::ASSETS_SLUGS['editor-css'], 'editor' );
}

/**
* Define theme strings.
*
* @param array $strings Strings.
* @return array
*/
public function strings( $strings = array() ) {
$strings = array(

// Generic patterns.
'hero_title' => __( 'Block Based Themes Made simple', 'raft' ),
'page_title' => __( 'This is a page title', 'raft' ),
'section_title' => __( 'This is section title', 'raft' ),
'subtitle' => __( 'Subtitle', 'raft' ),
'section_description' => __( 'A short section description', 'raft' ),
'paragraph_text' => __( 'This is placeholder text, feel free to replace it with your unique content as it\'s included here just to provide you with a better understanding of how your text will fit in the layout. Explore the various patterns and templates as you create your personalized web experience.', 'raft' ),
'short_text' => __( 'Just some placeholder text', 'raft' ),

// Feature patterns.
'feature_section_title' => __( 'Showcase your Features and Services', 'raft' ),
'feature_title' => __( 'This is feature title', 'raft' ),
'feature_description' => __( 'A placeholder description that you can replace with your own content.', 'raft' ),
'button_text' => __( 'Button Text', 'raft' ),

// Team patterns.
'team_section_title' => __( 'Our Team', 'raft' ),
'team_member' => __( 'Team member name', 'raft' ),
'member_role' => __( 'Company role', 'raft' ),

// Pricing patterns.
'pricing_section_title' => __( 'A pricing section. Join premium!', 'raft' ),
'plan_title' => __( 'Plan title', 'raft' ),
'price' => __( '$19.99', 'raft' ),
'price_feature' => __( 'A pricing feature', 'raft' ),

// FAQ patterns.
'faq_section_title' => __( 'Frequently Asked Questions', 'raft' ),
'faq_title' => __( 'Just a frequent question', 'raft' ),

// Content Patterns.
'content_title' => __( 'A generic content title', 'raft' ),
'content_subtitle' => __( 'A content subtitle', 'raft' ),

// Testimonial patterns.
'testimonial' => __( '"...Absolutely one of the best services out there, very professional and easy-going experience, highly recommended..."', 'raft' ),
'testimonial_name' => __( 'Jason Doe', 'raft' ),

// CTA patterns.
'cta_title' => __( 'Get started today, get in touch!', 'raft' ),
);

return $strings;
}
}
101 changes: 101 additions & 0 deletions inc/patterns/features-centered.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?php
/**
* Featured Block Pattern
*
* @author Themeisle
* @package raft
* @since 1.0.5
*
* slug: features-centered
* title: Centered Features
* categories: array( 'features' )
* keywords: feature, service, content
*/

$strings = apply_filters( 'raft_strings', array() );

$images = array(
RAFT_URL . 'assets/img/shape-07.svg', // Assuming 'shape-07.svg' is the file name.
);

return array(
'title' => __( 'Feature Block', 'raft' ),
'categories' => array( 'raft/features' ),
'content' => '
<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var:preset|spacing|80","bottom":"var:preset|spacing|80","right":"var:preset|spacing|40","left":"var:preset|spacing|40"},"margin":{"top":"0","bottom":"0"},"blockGap":"0px"}},"backgroundColor":"raft-bg-alt","layout":{"type":"constrained"}} -->
<div class="wp-block-group alignfull has-raft-bg-alt-background-color has-background" style="margin-top:0;margin-bottom:0;padding-top:var(--wp--preset--spacing--80);padding-right:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--80);padding-left:var(--wp--preset--spacing--40)">
<!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide">
<!-- wp:column {"style":{"spacing":{"blockGap":"0"}}} -->
<div class="wp-block-column">
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"default"}} -->
<div class="wp-block-group">
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|50","bottom":"var:preset|spacing|50","left":"var:preset|spacing|50","right":"var:preset|spacing|50"},"blockGap":"var:preset|spacing|30"}},"layout":{"type":"constrained","justifyContent":"center"}} -->
<div class="wp-block-group" style="padding-top:var(--wp--preset--spacing--50);padding-right:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)">
<!-- wp:image {"align":"center","id":289,"width":"128px","height":"128px","scale":"cover","sizeSlug":"large","linkDestination":"none","style":{"border":{"radius":"999px"}}} -->
<figure class="wp-block-image aligncenter size-large is-resized has-custom-border">
<img src="' . esc_url( $images[0] ) . '" alt="" class="wp-image-289" style="border-radius:999px;object-fit:cover;width:128px;height:128px"/>
</figure>
<!-- /wp:image -->
<!-- wp:heading {"textAlign":"center","level":3} -->
<h3 class="wp-block-heading has-text-align-center">' . esc_html( $strings['feature_title'] ) . '</h3>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">' . esc_html( $strings['feature_description'] ) . '</p>
<!-- /wp:paragraph -->
<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
<div class="wp-block-buttons">
<!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button">' . esc_html( $strings['button_text'] ) . '</a></div>
<!-- /wp:button -->
</div>
<!-- /wp:buttons -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:column -->
<!-- wp:column {"style":{"spacing":{"blockGap":"0"}}} -->
<div class="wp-block-column">
<!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"default"}} -->
<div class="wp-block-group">
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|50","bottom":"var:preset|spacing|50","left":"var:preset|spacing|50","right":"var:preset|spacing|50"},"blockGap":"var:preset|spacing|30"}},"layout":{"type":"constrained","justifyContent":"center"}} -->
<div class="wp-block-group" style="padding-top:var(--wp--preset--spacing--50);padding-right:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50)">
<!-- wp:image {"align":"center","id":289,"width":"128px","height":"128px","scale":"cover","sizeSlug":"large","linkDestination":"none","style":{"border":{"radius":"999px"}}} -->
<figure class="wp-block-image aligncenter size-large is-resized has-custom-border">
<img src="' . esc_url( $images[0] ) . '" alt="" class="wp-image-289" style="border-radius:999px;object-fit:cover;width:128px;height:128px"/>
</figure>
<!-- /wp:image -->
<!-- wp:heading {"textAlign":"center","level":3} -->
<h3 class="wp-block-heading has-text-align-center">' . esc_html( $strings['feature_title'] ) . '</h3>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">' . esc_html( $strings['feature_description'] ) . '</p>
<!-- /wp:paragraph -->
<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
<div class="wp-block-buttons">
<!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button">' . esc_html( $strings['button_text'] ) . '</a></div>
<!-- /wp:button -->
</div>
<!-- /wp:buttons -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:column -->
</div>
<!-- /wp:columns -->
</div>
<!-- /wp:group -->
',
);

0 comments on commit ea20f44

Please sign in to comment.