Support » Plugins » Language switcher plugin and sidebar’s php

  • EazyO



    I’m working on a theme for a friend, which he needs in two languages. I used the Mimbo theme as a base and this Language switcher plugin.

    Now, the problem arises due to the dual language nature of the site. Certain categories (along with posts and tags) are named [lang_en]News[/lang_en][lang_si]Novice[/lang_si] to allow for multiple language display.

    WP normally has no problem with that, reading posts, thread titles and tags and displaying them with ease. However, I suspect that due to this line in the sidebar…
    <?php echo $category->name; ?>
    …the category name is called into php and it in turn doesn’t know what to do with it, so it displays the whole thing like [lang_en]News[/lang_en][lang_si]Novice[/lang_si]

    Here’s the entire code for the “More in this category” bit of sidebar.php

    		if ( is_single() ) :
    		global $post;
    		$categories = get_the_category();
    		foreach ($categories as $category) :
       		$posts = get_posts('numberposts=30&exclude=' . $GLOBALS['current_id'] . '&category='. $category->term_id);
    		if(count($posts) > 1) {
    	<div class="widget">
    	<h3><?php _e('More in','Mimbo'); ?> '<?php echo $category->name; ?>'</h3>
    	<?php foreach($posts as $post) : ?>
    	<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    	<?php endforeach; ?>
    	<?php } ?>
    <?php endforeach; ?>
    <?php endif; ?>

    Also, here’s the plugin author’s tutorial on how to fix these things. I’ve tried applying filters as per the tutorial, but it’s not working for me. I just don’t know enough php to fix this, it seems.

    The url where we’re working on all of this is:

    I’d be ever so grateful for any help on getting the titles working in both English and Slovenian, as the next issue is almost launched and the new site is supposed to launch along with it.


  • The topic ‘Language switcher plugin and sidebar’s php’ is closed to new replies.