not-only-code / qtranslate-slug

Adds support for permalink translations and fix some Qtranslate deficiencies since wordpress 3.0
http://wordpress.org/extend/plugins/qtranslate-slug
46 stars 31 forks source link

Qtranslate Slug

Qtranslate Slug logo

Adds support for permalink ( slug / url ) translations for QTranslate-X

Description

Qtranslate Slug is an addon to QTranslate-X that adds support for permalinks translations. Qtranslate-X is a must have plugin for Multilingual Websites.

1.1.17 fixes a dangerous Security Exploit. Please update right now! Go ahead and update right 1.1.18 for the new cool fixes!

Requirements:

New in 1.1.18 =

and now, what isn't working:

In QTS slug options you can change the bases for taxonomies and custom post types.

So, for example, you can change /category/ for /category/ for english and /categoria/ for spanish version. But these won't work:

Thanks for using, enjoy 1.1.18. If anything breaks, let me know!

New in 1.1.17

New in 1.1.16

Minor fix for the language menu using qtranslate's function

New in 1.1.15

New in 1.1.14

The menu widget didn't allow the visitors to change to the default language if qtranslate-x was being used. So, adjusted the Language Menu widget to play nice with qtranslate-x. Hope to bring some nice changes that were made in the github repository in the next version. For now, enjoy.

New in 1.1.13

Thanks to returning @pedro-mendonca for these commits:

Thanks to @johnclause for these:

Thanks to vbkun for casting the much wanted function to get a slug based on an id and language

and sadly:

See you next Version!

Advice: If you're using a multisite installation, you will must activate qtranslate plugins by separately on each site.

You can also check the project website hosted on GitHub. Thanks for use this plugin!

Contributors

So many thanks to all that contributed to this plugin:

check the commits here

Installation

This plugins requires Qtranslate or mqTranslate installed previously, if not, it will not activate.

  1. Upload qtranslate-slug to the /wp-content/plugins/ directory.
  2. Activate the plugin through the 'Plugins' menu in WordPress.
  3. That's all!

Testing

  1. Install wp-cli
  2. Follow this instrucctions ommiting 2nd step: Plugin Unit Tests.

Changing base permastructs

  1. In admin: navigate to Settings/Slug options.
  2. Set the base permastructs for post types and taxonomies (If you setup a base permastruct for categories or tags in Settings/Permalinks, these will be overwritten by the translated ones).
  3. Save settings and that's all!

Frequently Asked Questions

It works with posts and pages, but with other content type?

This plugin allows to translate slugs of: posts, pages, custom post types, categories, tags and custom taxonomies.

Do I have to configure anything?

If you want to translate also the base permastructs (ex. category, tag, etc). Visit the plugin settings page in the admin Settings/Slug options

How can i insert a language selector in my theme ?

You can choose to:

Appears an error 404, what can i do?

In the admin go to Settings/Permalinks or Settings/Slug options and save.

I can't manage translations in Nav Menus.

That's because language selector metabox is hidden, if you are in admin nav menus screen, press the button Screen options (on top and right) and after, check the option Languages. It will appear a Language meta box on top of the left sidebar.

How to get the current url in a specific language?

You can use qts_get_url() or the awkwardly named qTranslateSlug_getSelfUrl() which is an alias for the first one.

Screenshots

Edit page Edit page for: post / page / post_type, you can see the meta box for translated slugs on top and right

Taxonomy page Add new taxonomy page

Edit taxonomy page Edit taxonomy page

Options page Qtranslate Slug options page for translate base permastructs of post_types and taxonomies

Changelog

New in Versions 1.1.12

New in Versions 1.1.10 and 1.1.11

New in Version 1.1.9

Lots of bug fixes! Thanks again to everyone that contributed to this project, with commits, bug reports and suggestions.

1.1.8

Many thanks to everyone that contributed to this update, for their commits, bug reports and for simply using it

1.1.7

1.1.7

1.1.6

1.1.5

1.1

1.0

0.9

0.8

0.7 Zapo

0.5 and 0.6 enhanched by Marco Del Percio

Upgrade Notice

1.0
Major version, the plugin has been rewritten. Better performance, and some enhancements.

0.9
This version fix some bugs and allow multilanguage in nav-menus.

0.8
A lot of slugs content allowed

0.7 This version allows TLD domain option for a different Qtranslate fork maded by Zappo

Other notes

Plugin filters reference:

qts_validate_post_slug
filter to process the post slug before is saved on the database.

args: $post (object), $slug (string), $lang (string)

qts_validate_term_slug
filter to process the term slug before is saved on the database.

args: $term (object), $slug (string), $lang (string)

qts_url_args
filter to process the entire url after it has been generated.

args: $url (string), $lang (string)

qts_permastruct filter to process the permastruct, used for change the base.

args: $permastruct (string), $name (string)

Todo