diff --git a/inc/custom-header.php b/inc/custom-header.php index 5e28481..0c04834 100644 --- a/inc/custom-header.php +++ b/inc/custom-header.php @@ -17,7 +17,10 @@ * @uses cenote_header_style() */ function cenote_custom_header_setup() { - add_theme_support( 'custom-header', apply_filters( 'cenote_custom_header_args', + add_theme_support( + 'custom-header', + apply_filters( + 'cenote_custom_header_args', array( 'default-image' => '', 'default-text-color' => '000000', @@ -37,13 +40,25 @@ function cenote_custom_header_setup() { * @return void */ function cenote_header_markup() { - $title = get_theme_mod( 'cenote_header_media_title', 'Hi, I am Header Media Title' ); - $text = get_theme_mod( 'cenote_header_media_text', 'I am description of header media. You can write short text to give me more info.' ); - $button_text = get_theme_mod( 'cenote_header_media_button_text', 'Take action' ); + $title = get_theme_mod( 'cenote_header_media_title', __( 'Hi, I am Header Media Title' ) ); + $text = get_theme_mod( 'cenote_header_media_text', __( 'I am description of header media. You can write short text to give me more info.' ) ); + $button_text = get_theme_mod( 'cenote_header_media_button_text', __( 'Take action' ) ); $button_url = get_theme_mod( 'cenote_header_media_url', '#' ); $is_info_enabled = get_theme_mod( 'cenote_header_media_enable_desc', true ); $style = get_theme_mod( 'cenote_header_media_style', 'cenote-header-media--center' ); + // Make dynamic text translatable with Polylang + if ( function_exists( 'pll_register_string' ) ) { + pll_register_string( 'cenote_header_media_title', $title, 'cenote' ); + pll_register_string( 'cenote_header_media_text', $text, 'cenote' ); + pll_register_string( 'cenote_header_media_button_text', $button_text, 'cenote' ); + } + + // Get translated strings + $title = function_exists( 'pll__' ) ? pll__( $title ) : $title; + $text = function_exists( 'pll__' ) ? pll__( $text ) : $text; + $button_text = function_exists( 'pll__' ) ? pll__( $button_text ) : $button_text; + if ( has_header_image() && is_front_page() ) { ?>
@@ -92,7 +107,7 @@ function cenote_header_style() { + ?> .site-branding { margin-bottom: 0; } @@ -101,10 +116,10 @@ function cenote_header_style() { position: absolute; clip: rect(1px, 1px, 1px, 1px); } - + ?> .site-title a, .site-description { color: #; @@ -114,3 +129,46 @@ function cenote_header_style() {