sage icon indicating copy to clipboard operation
sage copied to clipboard

WPML compatibility

Open coati opened this issue 14 years ago • 6 comments

Hi,

Roots theme gives problems with the combination of WPML. I've tested this on the latest WP (v3.3.1) and WPML (v2.4.3).

The problem

The filters of roots_root_relative_url() don't handle the url's to the tags as they should, it seems. This also impacts plugins like Yoast's SEO plugin, resulting in incorrect URL's in sitemaps.

E.g:

The tag URL's in a French (secondary language) post, generated by get_the_tags_list():

  • Expected result: absolute URL: http://site/blog/fr/tag/some-tag/ (or) relative URL: /blog/fr/tag/some-tag/)
  • Roots Result: /blog/tag/some-tag/

The language, /fr/ , is missing.

Suggestions

My temporary solution(s) is one of the following 3 suggestions:

  1. Disable the relative url settings in the Theme Options. Enable Root Relative URLs - No

  2. Comment following lines in roots/inc/roots-cleanup.php For older roots versions:

add_filter('the_tags', 'roots_root_relative_url');

add_filter('tag_link', 'roots_root_relative_url');

Latest roots version: Comment in $the_tags array (around line 70)

'the_tags',

'tag_link',

  1. Change the roots_root_relative_url() function. Replacing site_url() by home_url("/") seems to fix the tags urls. It keeps them relative and correct, but it might break other things. I didn't test this enough.

The first suggestion is the safest, but it would be great if there as a stable patch for this so relative url's can still be used.

Kind regards, Coati

coati avatar Apr 10 '12 13:04 coati

I'm also a WPML user, and I have encountered these issues also.

jevonearth avatar Apr 10 '12 14:04 jevonearth

thanks for the issue - number three sounds like a nice fix, will do some testing to see how it affects everything

retlehs avatar Apr 10 '12 16:04 retlehs

thx a lot! this should be fixed now.

retlehs avatar Apr 11 '12 03:04 retlehs

Hi retlehs, glad it worked. Looks stable to me too so far. Thank you for the theme!

coati avatar Apr 11 '12 09:04 coati

Adding an option to enable/disable relative urls would be nice instead of having to edit cleanup.php. This is especially useful with CDN, which require absolute urls to function properly.

elflo avatar May 01 '12 22:05 elflo

I would love to see an option for this too. I had to write some custom functions in my plugin to re-create the URLs since we need the full URL to source images to generate thumbnails.

daltonrooney avatar May 02 '12 00:05 daltonrooney