qtranslate-slug icon indicating copy to clipboard operation
qtranslate-slug copied to clipboard

Wrapper function to get URL

Open remyperona opened this issue 8 years ago • 2 comments

Hi,

I'm the lead developer of WP Rocket, a caching plugin (https://github.com/wp-media/wp-rocket)

We have customers using your plugin with qTranslate-X, and we're having one issue with our exclude pages option: it's the default slug that is added, instead of the translated slug.

For example: /cart/ and /fr/cart/ instead of /cart/ and /fr/panier/

We use the qtranxf_convertURL() to get the correct path for each language currently. So ideally, you can give us a way to work with that, or another option would be to have a wrapper function which given an id and a lang would return the full URL for the page.

Kinda like the qts_get_slug() function, but returning a full path/URL.

remyperona avatar Nov 30 '16 20:11 remyperona

Hi @Tabrisrp, sorry for the delay!

Would you want a function qts_get_url($lang = false) { that returns the full url based on an ID?

this qts_get_url() returns the url for the current page.

LC43 avatar Dec 06 '16 00:12 LC43

Yes qts_get_url( $id, $lang = false ) for example, that would be very good

remyperona avatar Dec 19 '16 15:12 remyperona