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.

This topic contains 0 reply, has 1 voice.

Last updated by Pierre 1 year, 2 months ago.

Author Posts
March 21, 2024 at 5:14 pm #15437739

Pierre

He, I have PHP issue. My custom language switcher shortcode output twice a href tags. Here are the details :

PHP

function top_language_switcher() {
$languages = apply_filters( 'wpml_active_languages', NULL, 'skip_missing=0' );
if(!empty($languages)){
foreach($languages as $l){
if(!$l['active']){
$html = '';
$html .= ''.$l['native_name'].'';
}
}
}
return $html;
}
add_shortcode( 'top_lang', 'top_language_switcher' );

HTML OUTPUT has two nested href anchors, please check the screenshot.

March 21, 2024 at 5:51 pm #15437988

Pierre

You can close the ticket. It was my falt (facepalm to myself) I've nested the shortcode in a "custom link" inside the top nav 🙄 So obvious lol. Sorry and thanks for your help.

March 21, 2024 at 5:51 pm #15437989

Pierre

You can close the ticket. It was my falt (facepalm to myself) I've nested the shortcode in a "custom link" inside the top nav 🙄 So obvious lol. Sorry and thanks for your help.