Support » Plugin: Multisite Language Switcher » Link to different custom post type

  • Hi,

    I didn’t dig in the code but I assume that given 2 blogs this plugin allows you to link posts of same post_type.

    Scenario: I have N languages and so N blogs. For each language I have a custom post type representing the same stuff (a product) but I want localized slugs. So, i.e., product for en, producto for es, prodotto for it etc.

    Is there a way to that with this plugin? Can I link post_type with slug A in blog 1 to post_type with slug B in blog 2?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Dennis Ploetner

    (@realloc)

    You can map them via code (in your functions.php for example):

    function my_msls_options_get_permalink( $url, $language ) {
        $locale = get_locale();
        $needle = '/product/';
        switch ( $locale ) {
            case 'es_ES':
                $url = str_replace( $needle, '/producto/', $url );
                break;
            case 'it_IT':
                $url = str_replace( $needle, '/prodotto/', $url );
                break;
        }
        return $url;
    }
    add_filter( 'msls_options_get_permalink', 'my_msls_options_get_permalink', 10, 2 );

    Thanks. I’ll try that.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Link to different custom post type’ is closed to new replies.