Translate custom Menu from Functions
-
Hello,
First thank you for your plugin and help.I have a SIGN IN, SIGN OUT and another page link IN MY MENU, THESE HAS BEEN ADDED FROM THE functions.php file and ofcourse i can’t see it in the wp-admin menus
So i can’t translate it from thereIs there any way to translate it from the fonctions.php file to switch between the 2 languages?
Here below the code in the functions file and the changes i have done:
function add_login_logout_register_menu( $items, $args ) { if ( $args->theme_location != 'primary' ) { return $items; } if ( is_user_logged_in() ) { $items .= '<li><a href="' . get_page_link('25026') . '">' . __( 'Spin Dashboard' ) . '</a></li>'; $items .= '<li><a href="' . get_page_link('37') . '">' . __( 'My Account' ) . '</a></li>'; $items .= '<li><a href="' . get_page_link('24842') . '">' . __( 'Sign Out' ) . '</a></li>'; } else { $items .= '<li><a href="' . get_page_link('37').'">' . __( 'Sign In' ) . '</a></li>'; }CHANGES I DID:
if ( is_user_logged_in() ) { $items .= '<li><a href="' . pll_get_post('25026') . '">' . pll__( 'Spin Dashboard','thegem' ) . '</a></li>'; $items .= '<li><a href="' . pll_get_post('37') . '">' . pll__( 'My Account','thegem' ) . '</a></li>'; $items .= '<li><a href="' . pll_get_post('24842') . '">' . pll__( 'Sign Out','thegem' ) . '</a></li>'; } else { $items .= '<li><a href="' . pll_get_post('37').'">' . pll__( 'Sign In','thegem' ) . '</a></li>'; }But links are broken Now on my web page
I’m not a programer so please any advice about how to manage this? is it correct to keep the page ID as i did (ex: pll_get_post(’37’) or do i have to put something else
I can’t see Sign In, Sign out etc… in Strings translation in wp-admin
I can’t see them in Loco TranslateWordpress: 4.9.4
Polylang: 2.3.4
Loco Translate: 2.1.3
PHP: 7
Theme: thegemThank you in advance
The topic ‘Translate custom Menu from Functions’ is closed to new replies.