WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Zenon Lite Theme slider multiple links? (23 posts)

  1. Niels V.
    Member
    Posted 1 year ago #

    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 http://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!

  2. Towfiq I.
    Member
    Posted 1 year ago #

    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

  3. Niels V.
    Member
    Posted 1 year ago #

    Thank you for your reply. I've replaced the lines :-)

    What's next?

  4. Towfiq I.
    Member
    Posted 1 year ago #

    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?

  5. Niels V.
    Member
    Posted 1 year ago #

    Nope - the website looks weird now and there're two empty slides in the slider, that doesn't exist in the slider editor page :D

  6. Towfiq I.
    Member
    Posted 1 year ago #

    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>

  7. Towfiq I.
    Member
    Posted 1 year ago #

    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.

  8. Niels V.
    Member
    Posted 1 year ago #

    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?

  9. Niels V.
    Member
    Posted 1 year ago #

    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 :-)

  10. Towfiq I.
    Member
    Posted 1 year ago #

    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:

    http://pastebin.com/tL9KsVuA

    and easyslider.php and replace all the code with one you find in this page:
    http://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.

  11. Niels V.
    Member
    Posted 1 year ago #

    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?

  12. Towfiq I.
    Member
    Posted 1 year ago #

    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.

  13. Niels V.
    Member
    Posted 1 year ago #

    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" ?

  14. Towfiq I.
    Member
    Posted 1 year ago #

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

  15. Niels V.
    Member
    Posted 1 year ago #

    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?

  16. Towfiq I.
    Member
    Posted 1 year ago #

    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 } ?>
  17. Niels V.
    Member
    Posted 1 year ago #

    Done. The pictures in the danish slider are gone and it doesn't link anywhere. Try clicking the danish flag and have a look.

  18. Towfiq I.
    Member
    Posted 1 year ago #

    <?php } else if(qtrans_getLanguage() == "dk") {?>

    change the word dk to DK maybe? how did you change the earlier one?

  19. Niels V.
    Member
    Posted 1 year ago #

    Ha ha you must be right! I don't know how I did it, but I'm kinda bummed that I did! Usually you keep everything lowercase when you code, right? :D

  20. Niels V.
    Member
    Posted 1 year ago #

    It worked! I can't thank you enough for this! You're truly a great person! Bless you!

    I do still have some small problems that I need help with, though. They should be an easy fix - I'm just stuck in the code!

    I'll make new topics for these problems now. Once again, thank you very much!

  21. Towfiq I.
    Member
    Posted 1 year ago #

    no problem! if you like the theme please rate it :)

  22. Niels V.
    Member
    Posted 1 year ago #

    I'll be sure to do so! I've just posted another problem that I need help with here

  23. Niels V.
    Member
    Posted 1 year ago #

    Resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic