Skip to content

Instantly share code, notes, and snippets.

@Farmatique
Created March 17, 2017 16:26
Show Gist options
  • Save Farmatique/c65363235e12ad9f66ad8281983951e4 to your computer and use it in GitHub Desktop.
Save Farmatique/c65363235e12ad9f66ad8281983951e4 to your computer and use it in GitHub Desktop.
add custom element inside menu-element in wordpress - 2nd variant
add_filter( 'walker_nav_menu_start_el', 'wpse_45647_add_custom_content', 'icl_post_languages', 10, 2 );
function wpse_45647_add_custom_content( $item_output, $item ){
if ('Choose Country' == $item->title) {// choose li-element here
$custom = icl_post_languages();//something custom to add
return str_replace( '<a ', $custom . '<a ', $item_output );
} else {
return $item_output;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment