Jump to content

Archived

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

jane

Using translation plugin - best option?

Recommended Posts

jane

Hi,

 

I'm currently using polylang on my site

 

I trying out the revslider on the home page but noticed that when I add text or a link to the image when I switch over to French the text and link are the same...I can't change it depending on language.

 

How do I updated the  revslider, mediabox content, etc depending on language? Right now the text is the same (does not allow me to have English text and French text).

 

Thanks

Share this post


Link to post
Share on other sites
Simon

Polylang works by having a totally different pages for each registered language. So you need to add a revslider/mediabox whatever to the english and german page for example.

 

Now this wont work if you use the 'blog' page as your home page as you can only have one blog page, unless you use some kind of plugin like special recent posts to emulate the blog page.

Share this post


Link to post
Share on other sites
jane

OK, so I went into "Reading Settings" and changed my home page to a static page so that I can edit the revslider independently regardless of language.

 

But what can I do about having a translated "branding area"? I have 2 different banners (English and French). Would I  need the support of another plugin to make translating the header possible?

Share this post


Link to post
Share on other sites
Simon

Well the header is a 'global' area, it would be possible to change the settings on the fly with WordPress php filters.

Share this post


Link to post
Share on other sites
jane

Do you know where I can find instructions on how to go about doing that?

Share this post


Link to post
Share on other sites
James B

Hi there, you can see an explanation of hooks and filters at http://wp.tutsplus.com/tutorials/the-beginners-guide-to-wordpress-actions-and-filters/

 

An example of adding hooks inside the Framework can be seen on http://docs.pagelines.com/advanced/hooks

 

The Wordpress reference file on filters can be found at http://codex.wordpress.org/Function_Reference/add_filter


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
jane

Thanks for the links although it is admittedly over my head.

 

 

In my case, I want to swap out the image in the branded area depending on the language of the site. I'm using a MediaBox for my header image so would I use something like this?

 

add_action( 'pagelines_before_mediabox', 'french_header_image' );
    
    function french_header_image(){

        if(pll_language_defined()=='fr'
     echo '<img src="www.website.com/wp-content/uploads/2014/01/image.png"';
}

....am I remotely on the right track? I'm not even sure if I've selected the right filter. How to I make sure this filter only effects my "branded area" media box and not the other media boxes on my site? Any guidance would be appreciated.

Share this post


Link to post
Share on other sites
James B

Hi there,

 

I was thinking about this and what you could do which might be easier is add two sliders in the header, one for each language. Then in each slider set a class in the 'styling field options'. For example 'englishslider' 'frenchslider'. http://screencast.com/t/6vLnDIFI2

 

Then using css and the page id for the page the language, show/hide that slider on the page depending on the language.

 

Screenshot - http://screencast.com/t/3b88wI7f6G

 

So for example on the French page the below should hide the english slider and just leave the french slider.

 

#page-id-2 .englishslider {display:none;}


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
jane

James, that would be a creative (and easier) way to go about doing what I'd like to do. But since the slider is a full width element that would mean I would  have to delete my search field and language changer from the header area, yes? And the logo would have to be really huge which isn't something I would like to do. Was the filter I proposed way off the mark?

Share this post


Link to post
Share on other sites
James B

Hi there, without seening a link to the live page I wouldn't be able to say on deleting the search field/language changer etc. Do you have a live link we can look at. You can place the banner/slider under the navbar in the header.

 

I'm not sure on the filter, php isn't my strongpoint unfortunately. However, looking at the code it seems to me that would insert the header image before every media box on the french page.


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
jane

Thanks James for the reply. I have the live link in my post from  03 February 2014 - 09:44 AM.

 

No worries about the php...I think though if hooks and filters are touted as a feature of DMS it would be nice if there was more instruction as to how to practically apply it! :) Even with one of the links you provided although it gave an example of an action that would delete the logo in the fixed navbar when I opened up Hooker/Hooks editor to try and apply it, I had no idea which hook to apply it to.

Share this post


Link to post
Share on other sites
Danny

In the DMS Pro Tools plugin there is an option called ActionMap, if you enable this and then visit your front page, there should be a new option called Action Map in the Wordpress Adminbar, click this and it will load all available hooks on your page, which you can use in your action hooks.

 

We also have a Karma plugin called Hooker, which makes applying hooks super simple, you can check it out on the store.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
jane

Thanks for the head's up Danny, I've enabled Action Map. I already have the Hooker plugin, my issue is that I have no idea how to use it. I'm sure with some studying/reading I could get a grasp of the basics but there don't seem to be any resources that go step by step as far creating hooks and then using the Hooker plugin.

Share this post


Link to post
Share on other sites
Danny

We documentation regarding hooks, but given the amount of things hooks can do its not really possible to cover the whole spectrum. However, our docs have been wrote to give you some friendly assistance, as well as including some examples which should help you.

 

http://docs.pagelines.com/advanced/hooks

 

In regards to the Hooker plugin, you just add your code, then select the hook location and fill out the other options if need be and thats it.

So instead of having to write:

 

add_action('blah','my_function');
  
  function mu_functions() {
    
   My code goes here
 
}

 

etc..

 

You just add your code to the text area there is no need to write add_action etc.. just your code.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
jane

Thanks Danny for that explanation. I'll just have to read up more on the theory of actions and hopefully I'll be able to apply them in the future.

 

Thanks

Share this post


Link to post
Share on other sites

×