Archived

This topic is now archived and is closed to further replies.

  • 0

Resolved Code to redirect link in boxes using qtranslate

Question

Posted · Report post

Hi. I actually have a similar question open, which was supposed to address both features and boxes. The features code was resolved, but still pending in the box.

I’m using PagelinePro theme for www.americasblindspot.com .

it's a bilingual site, spanish and english, using the Qtranslate plugin. But I need to add a code so that the the URLs I add in the boxes redirects to the appropriate language page.

Example: I switch my page to Spanish, and all the text is indeed translated correctly. But when I clik on a box link, it redirects back to the English version of that page.

The features issue was brilliantly resolved by Simon using the following code which I inserted in platformbase/functions using FTP

function add_lang_features($metadata, $object_id, $meta_key, $single){

if ( ! is_admin() && function_exists( 'qtrans_getLanguage' ) && isset($meta_key) && 'feature-link-url' === $meta_key) {

remove_filter( 'get_post_metadata', 'add_lang_features', 999, 4 );

$data = get_post_meta( $object_id, 'feature-link-url' );

$link = sprintf( '%s/?lang=%s', $data[0], qtrans_getLanguage() );

add_filter('get_post_metadata', 'add_lang_features', 999, 4);

return $link;

}

return $metadata;

}

add_filter('get_post_metadata', 'add_lang_features', 999, 4);

As a newbe, I tried editing the code by replacing 'features' with 'boxes' and inserting into platformpro/sections/boxes.php. Naturally it didn't work.

So my question is what code could I use and where should I place it?

thanks in advance

Share this post


Link to post
Share on other sites

5 answers to this question

Posted · Report post

Are you able to translate the linked page (from boxes) into Spanish individually? Does that give you a unique URL?

Okay, let me point out that when I click the Spanish flag on your homepage, the page is promptly translated to Spanish. Clicking the image for the box on the right, I am indeed taken to a page in English, but clicking again on the Spanish flag, that same page is given a new URL for the Spanish language. Specifically: http://www.americasblindspot.com/international-policy-consultancy/?lang=es

You need to create a custom link with the Spanish version.

Share this post


Link to post
Share on other sites

Posted · Report post

A appreciate your response, but it didn't really address my question. I realize the Spanish version is available with an additional click of the flag, regardless of the page. But I hope you'll understand that the point of having a bilingual page is to be able to surf it without having to press the flag for every single page. The point is for a Spanish reader to click the flag once, then to surf he same way English readers do.

The only problem is in the boxes. everything else works fine. Pagelinespro obviously needs additional coding to resolve this. Proof to that is that the same issue I had with features was resolves, as mentioned above, by adding a new code. Now I can press on a translated feature and it will redirect me to the appropiate page in the appropiate language.

My issue thus remains intact: what code can I add and where to resolve the translation issue in the boxes the same way it was resolved for the features?

thanks

Share this post


Link to post
Share on other sites

Posted · Report post

Dear PagelinePro forum: as you've probably noticed by now, because I've alerted you to do this, there are two similar posts addressing this same issue described above. I'm not quite sure how to proceed if the moderators and PagelinesPro people do not offer a solution. The PagelinesPro team simply decided not to offer further support. If I'm not going to get a response, would you be so kind as to advice me where I should turn to get support for the purchased PagelinePro product?

1 person likes this

Share this post


Link to post
Share on other sites

Posted · Report post

Please dont open new threads when you already have an open question. It slows down support for you.

Share this post


Link to post
Share on other sites

Posted · Report post

The topic was marked as resolved.

Share this post


Link to post
Share on other sites
This topic is now closed to further replies.