Jump to content


Photo
Resolved

Code to redirect link in boxes using qtranslate



  • This topic is locked This topic is locked
5 replies to this topic

#1 gcoppola7

gcoppola7

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • Country: Country Flag

Posted 12 October 2012 - 08:52 AM

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

#2 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 12 October 2012 - 09:49 PM

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.americasb...ltancy/?lang=es

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

#3 gcoppola7

gcoppola7

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • Country: Country Flag

Posted 15 October 2012 - 07:54 AM

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

#4 gcoppola7

gcoppola7

    Advanced Member

  • Members
  • PipPipPip
  • 33 posts
  • Country: Country Flag

Posted 16 October 2012 - 06:21 PM

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?
  • yoni likes this

#5 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 16 October 2012 - 06:55 PM

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

#6 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 16 October 2012 - 06:55 PM

The topic was marked as resolved.





Also tagged with one or more of these keywords: Resolved