'customizer', 'prefix' => 'woo_categories' ]; return $result; } if ($mode === 'disabled') { $result = false; return $result; } $result = [ 'strategy' => $taxonomy_options ]; return $result; } } $post_options = false; if (blocksy_is_page() || is_single()) { $post_options = blocksy_get_post_options(); $mode = blocksy_akg('has_hero_section', $post_options, 'default'); if ($mode === 'default') { $prefix = blocksy_is_page() ? 'single_page' : 'single_blog_post'; if (blocksy_is_page()) { if ( get_theme_mod( 'single_page_title_enabled', 'yes' ) === 'no' && !$allow_even_if_disabled ) { $result = false; return $result; } } if (is_single()) { if ( get_theme_mod( 'single_blog_post_title_enabled', 'yes' ) === 'no' && !$allow_even_if_disabled ) { $result = false; return $result; } } $result = [ 'strategy' => 'customizer', 'prefix' => $prefix ]; return $result; } if ($mode === 'disabled') { $result = false; return $result; } $result = [ 'strategy' => $post_options ]; return $result; } if (is_category() || is_tag()) { $taxonomy_options = blocksy_get_taxonomy_options(); $mode = blocksy_akg('has_hero_section', $taxonomy_options, 'default'); if ($mode === 'default') { if ( get_theme_mod( 'categories_has_page_title', 'yes' ) === 'no' && !$allow_even_if_disabled ) { $result = false; return $result; } return [ 'strategy' => 'customizer', 'prefix' => 'categories' ]; } if ($mode === 'disabled') { $result = false; return $result; } $result = [ 'strategy' => $taxonomy_options ]; return $result; } if (is_search()) { if ( get_theme_mod('search_page_title_enabled', 'yes') === 'no' && !$allow_even_if_disabled ) { $result = false; return $result; } return [ 'strategy' => 'customizer', 'prefix' => 'search' ]; } if (is_home() && is_front_page()) { if ( get_theme_mod('blog_page_title_enabled', 'no') === 'no' && !$allow_even_if_disabled ) { $result = false; return $result; } $result = [ 'strategy' => 'customizer', 'prefix' => 'blog' ]; return $result; } $result = false; return $result; } function blocksy_output_hero_section( $type = 'type-1', $is_cache_phase = false ) { $source = blocksy_get_page_title_source(); if (is_customize_preview()) { if (blocksy_is_page_title_default()) { if (! $is_cache_phase) { blocksy_add_customizer_preview_cache( '
' . blocksy_output_hero_section($type, true) . '
' ); } } else { blocksy_add_customizer_preview_cache('
'); } } if (! $source) { if (! $is_cache_phase) { return ''; } } $actual_type = blocksy_akg_or_customizer( 'hero_section', blocksy_get_page_title_source(), 'type-1' ); if ( function_exists('is_woocommerce') && ( is_product_category() || is_product_tag() ) ) { $actual_type = 'type-2'; } if ( !$is_cache_phase && $type !== $actual_type ) { return ''; } $title = ''; $description = ''; $post_id = null; if (is_home() && !is_front_page()) { $post_id = get_option('page_for_posts'); } if (function_exists('is_shop') && is_shop()) { $post_id = get_option( 'woocommerce_shop_page_id' ); } if (is_singular() || blocksy_is_page()) { if (! empty(get_the_title($post_id))) { $title = get_the_title($post_id); } if (has_excerpt($post_id)) { $description = blocksy_entry_excerpt( 40, 'page-description', $post_id ); } } else { if (! is_search()) { if (! empty(get_the_archive_title())) { $title = get_the_archive_title(); if (function_exists('is_shop') && is_shop()) { if (strpos($title, ':') !== false) { $title_pieces = explode(':', $title, 2); $title = $title_pieces[1]; } } if (strpos($title, ':') !== false) { $title_pieces = explode(':', $title, 2); $title = '' . $title_pieces[0] . '' . $title_pieces[1]; } } if (! empty(get_the_archive_description())) { $description = '
' . get_the_archive_description() . '
'; } } else { $title = sprintf( // translators: %s is the number of results __( 'Search Results for %s', 'blocksy' ), get_search_query() ); } } if (is_home() && is_front_page()) { $title = blocksy_akg_or_customizer( 'custom_title', blocksy_get_page_title_source(), ( function_exists('is_shop') && is_shop() ) ? __('Products', 'blocksy') : __('Home', 'blocksy') ); } if (is_home() && is_front_page()) { if (! empty(blocksy_akg_or_customizer( 'custom_description', blocksy_get_page_title_source(), '' ))) { $description = '
' . blocksy_akg_or_customizer( 'custom_description', blocksy_get_page_title_source(), ( function_exists('is_shop') && is_shop() ) ? __('This is where you can add new products to your store.', 'blocksy') : '' ) . '
'; } } if (! empty($title)) { $title = '

' . $title . '

'; } $has_meta = is_singular() && blocksy_akg_or_customizer( 'has_meta', blocksy_get_page_title_source(), blocksy_is_page() ? 'no' : 'yes' ) === 'yes'; $alignment_output = 'data-alignment="' . esc_attr(blocksy_akg_or_customizer( $type === 'type-1' ? 'hero_alignment1' : 'hero_alignment2', blocksy_get_page_title_source(), $type === 'type-1' ? 'left' : 'center' )) . '"'; if ( $type === 'type-1' ) { ob_start(); ?>
>
true, 'author_avatar' => true, 'post_date' => true, 'comments' => true, 'categories' => true, ], [ 'avatar_size' => '50', ] ); } if (! is_singular()) { echo wp_kses_post($description); } ?>
null ] ); if ($custom_background_image['attachment_id']) { $attachment_id = $custom_background_image['attachment_id']; } } $parallax_output = ''; if ( $page_title_bg_type === 'custom_image' || $page_title_bg_type === 'featured_image' ) { if ( blocksy_akg_or_customizer( 'enable_parallax', blocksy_get_page_title_source(), 'no' ) === 'yes' ) { $parallax_output = 'data-parallax'; } } ob_start(); ?>
>
$attachment_id, 'ratio' => '16/9', 'size' => 'full', ])); ?>
true ], [ 'labels' => false ] ); } echo wp_kses_post($title); echo wp_kses_post($description); if ($has_meta) { /** * Note to code reviewers: This line doesn't need to be escaped. * Function blocksy_post_meta() used here escapes the value properly. * Mainly because the function outputs SVG. */ echo blocksy_post_meta( [ 'author' => true, 'author_avatar' => true, 'post_date' => true, 'comments' => true, ], [ 'avatar_size' => '50', ] ); } ?>