This is feature one
Item two includedOptional item threeService four includedAnd finally, item five';
break;
case 'social-media':
return '';
break;
default:
return '';
break;
}
}
function alara_pattern_categories() {
return array(
/* translators: %s: Name of active theme, Alara if parent, or child theme name */
'new' => sprintf( __( '★ %s - New ★', 'alara' ), ALARA_THEME_NAME ),
'headers' => sprintf( __( '%s - Headers', 'alara' ), ALARA_THEME_NAME ),
'headers-boxed' => sprintf( __( '%s - Headers Boxed', 'alara' ), ALARA_THEME_NAME ),
'footers' => sprintf( __( '%s - Footers', 'alara' ), ALARA_THEME_NAME ),
'welcome' => sprintf( __( '%s - Welcome', 'alara' ), ALARA_THEME_NAME ),
'blog' => sprintf( __( '%s - Blog', 'alara' ), ALARA_THEME_NAME ),
'about' => sprintf( __( '%s - About', 'alara' ), ALARA_THEME_NAME ),
'features' => sprintf( __( '%s - Features', 'alara' ), ALARA_THEME_NAME ),
'cta' => sprintf( __( '%s - Call to Action', 'alara' ), ALARA_THEME_NAME ),
'reviews' => sprintf( __( '%s - Reviews', 'alara' ), ALARA_THEME_NAME ),
'pricing-tables' => sprintf( __( '%s - Pricing Tables', 'alara' ), ALARA_THEME_NAME ),
'recipes' => sprintf( __( '%s - Food Recipes', 'alara' ), ALARA_THEME_NAME ),
'covers' => sprintf( __( '%s - Covers', 'alara' ), ALARA_THEME_NAME ),
'full-pages' => sprintf( __( '%s - Full Pages', 'alara' ), ALARA_THEME_NAME )
);
}
function alara_patterns_full_page() {
return array(
'welcome-cover,spacer,specifications-2,spacer,reviews-2,spacer,team-2,spacer,get-in-touch-1',
'welcome-2,spacer,feature-comparison-2,spacer,specifications-4,spacer,pricing-table-4,spacer,get-in-touch-2'
);
}
function alara_get_patterns() {
$patterns_dir = ALARA_TEMPLATE_DIR . '/inc/patterns/';
if ( file_exists( $patterns_dir ) && is_dir( $patterns_dir ) ) {
$patterns = scandir( $patterns_dir );
$patterns_array = array_diff( $patterns, array( '.', '..' ) );
} else {
$patterns_array = array();
}
return $patterns_array;
}
function alara_register_patterns() {
$categories = alara_pattern_categories();
foreach ( $categories as $category_slug => $category_label ) {
register_block_pattern_category(
'alara-' . $category_slug,
array( 'label' => $category_label )
);
}
$patterns = alara_get_patterns();
foreach ( $patterns as $pattern_slug ) {
register_block_pattern(
'alara/' . preg_replace( "/\.php$/", "", $pattern_slug ),
require ALARA_TEMPLATE_DIR . '/inc/patterns/' . $pattern_slug
);
}
}
add_action( 'init', 'alara_register_patterns', 9 );
function alara_register_patterns_full_page() {
$full_pages_array = alara_patterns_full_page();
foreach ( $full_pages_array as $full_page ) {
$pattern_slugs = explode( ',', $full_page );
$full_pattern = array();
$full_pattern_slug = '';
$full_pattern_title = '';
$full_pattern_content = '';
foreach ( $pattern_slugs as $pattern_slug ) {
$sub_pattern = include ALARA_TEMPLATE_DIR . '/inc/patterns/' . $pattern_slug . '.php';
$full_pattern_slug .= $pattern_slug . '-';
if ( $pattern_slug !== 'spacer' ) {
$full_pattern_title .= $sub_pattern['title'] . __( ' + ', 'alara' );
}
$full_pattern_content .= $sub_pattern['content'];
}
$full_pattern_slug = preg_replace( "/\-$/", "", $full_pattern_slug );
$full_pattern_title = preg_replace( "/\ \+ $/", "", $full_pattern_title );
$full_pattern['title'] = $full_pattern_title;
$full_pattern['content'] = $full_pattern_content;
register_block_pattern(
'alara/' . $full_pattern_slug,
array(
'title' => $full_pattern['title'],
'categories' => array( 'alara-full-pages' ),
'viewportWidth' => 1440,
'content' => $full_pattern['content']
)
);
}
}
add_action( 'init', 'alara_register_patterns_full_page', 9 );
function alara_site_info() {
return '©' . esc_html( date('Y') ) . ' ' . esc_html( get_bloginfo('name') ) . '';
}
function alara_theme_info() {
return '' . esc_html__( 'WordPress', 'alara' ) . ' | ' . esc_html( ALARA_THEME_NAME ) . '';
}
register_block_pattern(
'alara/theme-info',
array(
'title' => __( 'Theme Information', 'alara' ),
'inserter' => false,
'content' => '
' . alara_site_info() . '
' . alara_theme_info() . '
',
)
);
register_block_pattern(
'alara/theme-info-centered',
array(
'title' => __( 'Theme Information Centered', 'alara' ),
'inserter' => false,
'content' => '
' . alara_site_info() . '
' . alara_theme_info() . '
',
)
);