Exclude link with rel attribute "external" from parsing
-
I want to sharing with you a problem that I’ve encountered on one of my website customer.
there was an external link that begin like:
https://www.example.com/ecommerce/….
where the website of customer is like:
Transposh rewrite url in this mode:
https://www.customer.com/ommerce/…
so trunk the first 2 letters of first argument.
So, I think I’ve found a solution. In row 766 of file parser.php, there’s a foreach loop to rewrite url for all “a” tags. I’ve add the rel=”external” control to exclude it from translation.
So you can edit in this mode:
foreach ($this->atags as $e) {
if ($e->href && strcasecmp($e->rel, “external”) != 0)
$e->href = call_user_func_array($this->url_rewrite_func, array($e->href));
}I’ve add the “strcasecmp” function to control the content of rel attribute of link. And this works fine!
I wish this can help someone like me.
https://www.ads-software.com/extend/plugins/transposh-translation-filter-for-wordpress/
- The topic ‘Exclude link with rel attribute "external" from parsing’ is closed to new replies.