WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Permalink Slugs in multiple languages (7 posts)

  1. estepix
    Member
    Posted 1 year ago #

    is there any way of getting the permalinks for events manager translated into multiple languages? I mean the slugs you configure in Events > Settings > Pages > Permalink Slugs

    I'm no stranger to php, so any solution is welcome even if it means using filter hooks, etc.

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 1 year ago #

    this isn't available at the moment however maybe this can give you an idea - http://wordpress.org/support/topic/plugin-events-manager-date-in-the-permalink?replies=9

  3. estepix
    Member
    Posted 1 year ago #

    that reference is great to change an event permalink, however I'm trying to modify Events Categories which does not seem to be possible as there is no such a hook as 'em_event_categories_get_permalink'

  4. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    isn't this something your ML plugin would/should handle? for example i believe WPML does this already.

    we get that permalink using normal WP methods, e.g. $this->link = get_term_link($this->slug, EM_TAXONOMY_CATEGORY); within classes/em-category.php

    EM_TAXONOMY_CATEGORY is decided in em-posts.php, which you could hook into and intercept the option value using option_... filter.

    we could add a filter if that'd help.

  5. estepix
    Member
    Posted 1 year ago #

    I think I didn't explain myself properly, let's say I have a multilingual site, Spanish as main language, English as second. I go to
    Events > Settings > Pages > Permalink Slugs
    and set Event Categories field to:
    eventos/categorias
    So my event categories will have the following urls:
    http://mysite.com/eventos/categorias/conciertos

    The problem is that in English I get:
    http://mysite.com/en/eventos/categorias/concerts

    The events/categories part cannot be translated afaik

    By the way, thanks for your time!!!

  6. estepix
    Member
    Posted 1 year ago #

    I just hooked into EM_TAXONOMY_CATEGORY_SLUG which is defined in em-posts.php and which I think is the one I need to change to alter the URL. It seems to work on Events > Settings > Pages > Permalink Slugs, the Event Categories field changes for English and Spanish, however it does not work anywhere on the site, I still get:

    es-ES: http://mysite.com/eventos/categorias/conciertos
    en-US: http://mysite.com/en/eventos/categorias/concerts

    This is the filter I'm using:

    function em_wpml_dbem_taxonomy_category_slug($option){
        $lang = get_bloginfo('language');
    
        if( $lang === 'es-ES' ){
            $option = 'eventos/categorias';
        } else {
            $option = 'events/categories';
        }
        return $option;
    }
    add_filter('pre_option_dbem_taxonomy_category_slug', 'em_wpml_dbem_taxonomy_category_slug');

    add_filter('option_dbem_taxonomy_category_slug', 'em_wpml_dbem_taxonomy_category_slug');
    Note that I used a pre_option and option filter to just to make sure, in case the option_ was not enough...

    It seems like the plugin is using the database option value to build all urls and this bypasses my filter, is that so?

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    ok, I'm assuming you're using WPML here.

    I'm working on solutions to WPML at the moment, but haven't gotten as far as taxonomies yet. However, as far as I'm aware wpml allows you to translate custom taxonomies from witihin the WPML settings.

    btw, in your code above, pretty sure you want to use something like

    global $sitepress;
    $sitepress->get_current_language();

    and use two char codes, e.g. 'es'

    probably why it's always defaulting to english

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic