Jump to content
gcoppola7

Code to redirect link in boxes using qtranslate

Recommended Posts

gcoppola7

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
Rob

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.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
gcoppola7

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
gcoppola7

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?

  • Like 1

Share this post


Link to post
Share on other sites
Simon

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
Simon

The topic was marked as resolved.

Share this post


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

  • Similar Content

    • janpeeters
      By janpeeters
      Over the last month I had extensive communications with the developer of the (premium) Anything Boxes section (in Pagelines store) (Adam Munns) and the developer of the WP Polylang Multilingual plugin (Frederic Demarle).
       
      This was because the following problem occurred:
      Anything Boxes showed all posts of two languages (Dutch and English) on the respective static frontpages for each language. It should of course have filtered posts for Dutch language on the Dutch frontpage and English on the English frontpage.
       
      The solution to this problem was simple in the end. When duplicating a page for use in another language the settings for Anything Boxes were not copied to the new page and I should have set these settings manually again on the new page. I wasn't aware of this, but it makes sense. Because of this the pages didn't know how to differentiate between posts from different languages.
       
      The dev of Polylang told me that Polylang is currently smart enough to synchronize metas like Featured images and page templates but it does not work out of the box with metas created by plugins and themes but (according to Frederic) it is rather easy to add them in the list using the filter 'pll_copy_post_metas'.
      He mentions that he is not sure that these 'PageLines Meta Settings' are stored in post meta but that would make sense according to him. He asks if the Pagelines dev team will be interested to support this feature in the future.
       
      I'm also wondering if you will consider adding Polylang translation support for manually editable strings like the 'Read more…' strings in Pagelines Settings.
       
      Well that's of course up to you but I thought to let you know to be able to take this into consideration. I also post this for other users in case they experience the same kind of trouble and are looking for an answer.
       
      Best regards,
      Jan Peeters
    • bankrollbuilder
      By bankrollbuilder
      I used a custom hook to put a banner ad in my header. It works but its not in the right position. it is centered and above my logo and I would like to float it to the right of my logo in the header. heres the link: http://shaboopie.com/shaboopie-wp/free-logos-pg1/

      thanks.

      Dan B.
    • starlit
      By starlit
      Can one have two hero sections on one page?

      I want a landing page which leads/advertises two subpages.

      Or is there another option?

      Please help.

      THANK YOU
    • hutruk
      By hutruk
      Hi!

      I am using the shortcodes for tabs, as described in the documentation.

      When I insert the following code:


      [pl_tabs][pl_tabtitlesection type="tabs"] [pl_tabtitle number="1"]Title 1[/pl_tabtitle] [pl_tabtitle number="2"]Title 2[/pl_tabtitle] [/pl_tabtitlesection] [pl_tabcontentsection] [pl_tabcontent active="yes" number="1"] Lorem ipsum dolor sit amet, consectetur adipiscing elit [/pl_tabcontent] [pl_tabcontent number="2"] Lorem ipsum dolor sit amet, consectetur adipiscing elit [/pl_tabcontent] [/pl_tabcontentsection] [/pl_tabs]

      I get a strange output (in the attachment).

      Any ideas?

      Thanks in advance!

    • MooiWeb
      By MooiWeb
      Hello,

      I would like to align my qtranslate with my breadcrumb so that the flags are on the same hight.
      I'm aware of putting a code in the custom css and tryed severall codes from your site but for now, no succes

      The site i'm working on is http://nieuw.vazdias.nl

      Thx,
      Edwin



×