WordPress.org

Ready to get started?Download WordPress

Forums

Polyglot + Navigo (3 posts)

  1. wersh
    Member
    Posted 8 years ago #

    I'm trying to use Polyglot and navigo together on the same blog.

    With Polyglot, I can give a page a different title for each language. For example,

    <lang_en>About Us</lang_en><lang_es>Sobre Nosotros</lang_es><lang_fr>Au sujet de Nous</lang_fr>

    When using the built-in function wp_list_pages, as in

    <?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>

    the page is given the proper language title in the menu listing.

    When using navigo like this though,

    <?php if(function_exists('navigo')) navigo('collapse=true&sort_column=menu_order'); ?>

    no language filtering is done, which results in all three languages showing up in the menu.

    In other words, Polyglot and Navigo don't work properly together. :)

    Has anyone messed around with using these two together and figured out how to get it working properly? I don't want to try to "reinvent the wheel" if someone else has already dealt with this successfully.

    Alternatively, if anyone is familiar enough with them to point me in the right direction, I'd appreciate that, too.

  2. wersh
    Member
    Posted 8 years ago #

    I figured out how to do it.

    In navigo.php, line 172 should be similar to this:

    $content .= '<a' . $current . ' href="' . get_page_link($page_id) . '"
    title="' . wp_specialchars($cur_page['title']) . '">' . $cur_page['title'] . '</a>';

    Change that to this:

    $title = apply_filters('navigo_title', $cur_page['title']);
    $content .= '<a' . $current . ' href="' . get_page_link($page_id) . '"
    title="' . wp_specialchars($title) . '">' . $title . '</a>';

    Then in polyglot.php, somewhere around line 100-115 you should find the list of filters. Add this somewhere in there (or anywhere in the file, really):

    add_filter('navigo_title', 'lang_picker_respect_more',1);

    The nice thing is that this doesn't break anything if you only have one of the two plugins activated for some reason. :)

  3. chillosoph
    Member
    Posted 7 years ago #

    Hey Wersh, just found this very helpfull topic.
    Your solution works perfectly for me,
    many thx!

Topic Closed

This topic has been closed to new replies.

About this Topic