Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 - -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by Noman 8 months, 3 weeks ago.

Assisted by: Noman.

Author Posts
May 7, 2024 at 5:49 pm #15603449

georgiosS-12

Hello
I have this website
hidden link

And if you scroll down you will see a sticky header with a menu and a big picture banner.
I have done it on greek so i have the greek banner when you scroll down. My question is how i can make it on english version to change the picture and have the english banner on english version home page and english version of sticky header. When you click on the banner it drives you on a greek poster. So i want the same when you hit the english banner to drive on english poster. I want to tell you on that point that i insert that banner with coding on header2 php file and its not from settings of template.
Also i want to tell you that i tried with media translation but doesnt work for that.

This is the code of the sticky header 2 contect so on eng version i want another picture. Is any folder that the header 2 duplicated for wpml?

<!--START navigation-->
<div id="nd_options_navigation_2_sticky_container" class="nd_options_section nd_options_position_fixed nd_options_z_index_10 nd_options_navigation_2_sticky_move_up nd_options_display_none_all_responsive">

<div style="background-color: <?php echo esc_attr($nd_options_customizer_header_2_bg); ?> ; border-bottom: 1px solid <?php echo esc_attr($nd_options_customizer_header_2_divider_color); ?> ;" class="nd_options_section">

<div style="height: 20px;" class="nd_options_section"></div>

<div class="nd_options_navigation_2 nd_options_navigation_type nd_options_text_align_center nd_options_display_none_all_responsive">

<!-- Picture for Sticky Menu -->
<div class="nd_options_picture_sticky">
hidden link" target="_blank">
<img src="hidden link" target="_blank" alt="Sticky Picture">
</div>

greek-version_sticky_header_banner.JPG
May 7, 2024 at 5:51 pm #15603465

georgiosS-12

Second picture for english version

eng-version_sticky_header_banner.JPG
May 8, 2024 at 8:37 am #15604838

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting WPML Support. As you have added that banner in PHP file so you may use PHP if/else statements to display the Greek and English banner according to the current language by following the below steps:

You can get the current language using wpml_current_language hook and display the content based on the selected language. Here is an example:

// Get the current language
$my_current_lang = apply_filters( 'wpml_current_language', NULL );

// If Greek language is selected
if( $my_current_lang == 'el' ) {
	// Greek language banner content goes here
}

// If English language is selected
elseif( $my_current_lang == 'en' ) {
	// English language banner content goes here
}

Here is a doc for more details:
https://wpml.org/wpml-hook/wpml_current_language/

Please let me know if you have any questions.
Thank you

The topic ‘[Closed] Different banner picture header on sticky top header (eng version)’ is closed to new replies.