lightblack
Member
Posted 2 months ago #
Hi ,
I want to make my menu use localization terms the links work but I cannot make it set the class 'current'
<?php
if (is_single() && in_category('_e("mycat")')is_child(110)) {
{ echo ' class="current"'; }?>
<?php } ?>>
<a>/<?php _e('mycat'); ?>" title="<?php _e('mycat'); ?>"><?php _e('mycat'); ?></a>
How do I use the if-conditional in wordpress with the _e() function?
Thanks and best regards
Check this tutorial for dynamic menu.
lightblack
Member
Posted 2 months ago #
hi and thanks for your reply.
My actual problem is not the highlighting of the menu but how to make the term _e("mycat") translatable(localization).
I would like to have the category term e.g. about translated depending on the language <?php if (is_page('about') ) so in German it looks for the catgory name 'ueber' by using the _e() function.
I'm not sure what I'm missing syntax error this does not work.
in_category('_e("mycat")')
Thanks
lightblack
Member
Posted 2 months ago #
I found the solution.
You cannot use the e() function you need to use the __() function to return the string.
<li<?php
if (is_single() && in_category(__('about', 'themeName')) || is_child(123)) {
{ echo ' class="current"'; }?>
<?php } ?>>
<a id="nav1" href="<?php bloginfo('url'); ?>/<?php _e('about','themeName'); ?>" title="<?php _e('About','themeName'); ?>"><?php _e('About','themeName'); ?></a></li>