• Resolved Niels V.

    (@niels-v)


    Hi

    I hope someone can illuminate me on this!

    I’m using the qTranslate plugin to make my site multilingual. I want it to support two languages. Now my problem is this:

    When the user has chosen the danish language, the slider needs to change the link, so the user is pointet to the appropriate page with danish text, when clicking on the slider. Unfortunately, the slider only supports one link per slide. Therefore, the user will be redirected to the page with the english language, instead of the danish one.

    Would it be possible to add support for multiple links per slide to make the experience better on multilingual websites, and if so, how can this be done?

    Try it for yourself on my website at https://www.nielsvandel.com

    1) Choose the danish language in the footer.
    2) Choose the slide that says “About me”
    3) Notice how the text is not danish, but english ??

    This problem does not occour when choosing through the menu.

    I thank you in advance for your help!

Viewing 15 replies - 1 through 15 (of 22 total)
  • Lets first make the theme translatable. Open up easyslider.php and replace this line:

    <?php the_title( '<h2 class="entry-title"><a href="' . $znndata . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h2>' ); ?>

    with this:

    <a href="<?php echo $znndata; ?>"> <?php the_title(); ?></a>

    -Theme Author

    Thread Starter Niels V.

    (@niels-v)

    Thank you for your reply. I’ve replaced the lines ??

    What’s next?

    replace the the line you added:

    <a href="<?php echo $znndata; ?>"> <?php the_title(); ?></a>

    with this:

    <h2 class="entry-title"><a href="<?php echo $znndata; ?>"> <?php the_title(); ?></a>

    Now can you translate the title from slider editor page?

    Thread Starter Niels V.

    (@niels-v)

    Nope – the website looks weird now and there’re two empty slides in the slider, that doesn’t exist in the slider editor page ??

    crap! there was a typo. replace this line:

    <h2 class="entry-title"><a href="<?php echo $znndata; ?>"> <?php the_title(); ?></a>

    with this:

    <h2 class="entry-title"><a href="<?php echo $znndata; ?>"> <?php the_title(); ?></a></h2>

    do you know how to use the conditional tag of qtranslate? I mean is there any conditional tag? can you look it up in their forum or documentation?

    to have different links for different language you will need the conditional tags of qutranslate.

    Thread Starter Niels V.

    (@niels-v)

    I don’t know anything about conditional tags, but I’ll do my best to look it up ??

    I won’t have the time for it before next week, though. Looks like the new line you provided made everything go back to normal, except the excerpts of the differents slides are missing. I’m guessing that this has something to do with these conditional tags?

    Thread Starter Niels V.

    (@niels-v)

    I found a thread on the qTranslate forum that I think describes the problem. The tread only has 9 posts – could I make you take a look at it?

    Thanks ??

    you will have to edit the template file directly this way:

    Open up functions.php and replace this all the code with the code you find in this page:

    https://pastebin.com/tL9KsVuA

    and easyslider.php and replace all the code with one you find in this page:
    https://pastebin.com/zutHednz

    after doing that you will find 3 new text field in the slider editor page. they are:

    Danish Title
    Danish Link
    Danish Text

    fill out all the fields and when you click the Danish flag again from the front-end your what you entered via back-end will be shown.

    Thread Starter Niels V.

    (@niels-v)

    Done. It doesn’t seem to work though. When clicking the danish flag the slides appear empty and they still link to the english version.

    Could it be because I have to restart Qtranslate or something like that?

    it could be this line:
    <?php } else if(qtrans_getLanguage() == "da") {?>

    whats the ISO language code? I assumed, “da” is it “dk” or da? maybe you can ask them in the forum.

    Thread Starter Niels V.

    (@niels-v)

    It kinda works now. The language code is “DK” with capital letters. The slider link still doesn’t work though.

    Are there other places in the code where “da” should be replaced with “DK” ?

    Just checked your site. looks like its working fine….

    Thread Starter Niels V.

    (@niels-v)

    Try clicking one of the slides in the slider after choosing the danish language. It still links to the english version of the page. Any idea what causes this?

    oh right! I forgot to change the links of the images. just changed the title links. open up easyslider.php and replace this line:

    <a href="<?php echo $znndata; ?>"><?php the_post_thumbnail(); ?></a>

    with this:

    <?php if(qtrans_getLanguage() == "en") { ?>
    <a href="<?php echo $znndata; ?>"><?php the_post_thumbnail(); ?></a>
    <?php } else if(qtrans_getLanguage() == "dk") {?>
            <a href="<?php echo $znndalink; ?>"><?php the_post_thumbnail(); ?></a>
    <?php } ?>
Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Zenon Lite Theme slider multiple links?’ is closed to new replies.