Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gets not translated slug from WPML #27

Open
abombelli opened this issue May 13, 2014 · 5 comments
Open

Gets not translated slug from WPML #27

abombelli opened this issue May 13, 2014 · 5 comments

Comments

@abombelli
Copy link

When using WPML to translate the CPT slug, the according language is not reflected in the permalink when inserting an archive menu entry.

@gmazzap
Copy link
Contributor

gmazzap commented May 13, 2014

@stephenharris I think this issue is not only related to WPML, because the menu item printing ignore the CPT labels (and so any associated translation). That can be easily solved replacing menu item title with the CPT object label. Already created a branch with that fix, see here

@abombelli
Copy link
Author

@Giuseppe-Mazzapica I updated the plugin, unfortunately the slug is still the wrong one. Any other idea?

@gmazzap
Copy link
Contributor

gmazzap commented May 15, 2014

@abombelli the plugin is not updated using my code, so even if you update the plugin from this repo (or from wordpress.org) it is unchanged. You can try to use the Issue#27 brance on my fork or wait for when Stephen have time to look at it and maybe can merge.

@abombelli
Copy link
Author

@Giuseppe-Mazzapica Just tried your fork, but the slug is still not the translated one who appears.

@abombelli
Copy link
Author

@Giuseppe-Mazzapica Not completely tested, but it works. I added the following after line 381:

        // WPML - get translated CPT slug
        if ( function_exists( 'icl_translate' ) ) {
            $translated_slug = icl_translate('wpml_custom', 'wpml_custom_'.$post_type, $post_type);
            if ($translated_slug != '') {
                $menu_item->url = home_url( user_trailingslashit( $translated_slug, 'post_type_archive' ) );
            }
        }

The slug has to be translated before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants