• Resolved hisopio

    (@hisopio)


    Hello, I like the plugin, but I’m having lots of problems making it work with qtranslate. I have my site in three languages, FR (default), EN and ES. qtranslate automatically adds a pre-path to the pages depending in the language selected, like this : https://www.payasito.fr/en/choose or https://www.payasito.fr/fr/choose
    the problem is when I link an image in the gallery with a relative path like: /2013/688 it doesn’t keep the pre-path and the plugin always turns it to the default https://www.payasito.fr/2013/688 no matter the language selected.
    Is there a way to make the plugin keep the pre-path on the links?
    Thanks.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Hm, I’ll do some testing and look into it. Are the images still showing up fine, it’s just that the links that aren’t keeping the language-specific “folder”?

    Actually, that makes sense – all the plugin does is swap in the value of the custom url for the href of the link around the image. So what you’re describing is having a context-sensitive link around your images. I’ll play around with it and see if there’s a simple solution – maybe you could look into relative links as well?

    I installed the qtranslate plugin, and from /de/gallery-test/ I linked one of my gallery images to “../services/” (which would normally be /services/) and it went to /de/services/. This may not work universally, but I think the alternatives are either a) to upload multiple copies of every image and change the absolute link on each to be language specific, or b) I add a filter to the WP Gallery Custom Links plugin where you could add your own code to customize the links before they are swapped into the gallery (i.e., prefix them with “en” or “de” using some function or variable from qtranslate). But before I do that, let me know if the simpler solution of relative urls will work for you.

    Thread Starter hisopio

    (@hisopio)

    hello, thanks a lot for the quick answer.
    I tried every relative url I could imagine without success, and I thought about uploading one copy of each image for each language, the problem is that I have around 150 images and multiplying that to 3 languages makes a lot of not very fun work. A filter would be ideal of course… or I’ll do some html tables…

    When you say the relative urls didn’t work – can you show me an example of one of the galleries, the value you entered for the custom link, and describe how it failed?

    Thread Starter hisopio

    (@hisopio)

    I showed you an example in my first message. The relative path I’m using is: “/2013/688” I tried “../2013/688” too. It always takes me to https://www.payasito.fr/2013/688 never manage to get: https://www.payasito.fr/en/2013/688

    Hm, not sure why that’s working for me but not you. I’ll look into adding a filter for the links, although this will not be an immediate update.

    Thread Starter hisopio

    (@hisopio)

    Okey, don’t bother if it’s too complicated, I’ll use a table. I want to finish it this week.
    Thanks a lot anyway!

    I’ve uploaded a beta version of the modified plugin here:

    https://www.fourlightsweb.com/temp/wp-gallery-custom-links.php.txt

    Try swapping that in and using the following filter (you’ll need to adjust as necessary for whatever function/value qtranslate is adding):

    add_filter( 'wpgcl_filter_raw_gallery_link_url', 'my_gallery_link_url_filter', 10, 3 );
    function my_gallery_link_url_filter( $link, $attachment_id, $post_id ) { return '/en/' . $link; }

    and let me know how that goes. If it works out, I’ll push it as version 1.8.0.

    Thread Starter hisopio

    (@hisopio)

    Caramba! thanks! I’ll give it a try!

    Thread Starter hisopio

    (@hisopio)

    mmh, I installed everything alright, but now it puts “/en/” no mater which language I choose… am I missing something?

    Thread Starter hisopio

    (@hisopio)

    okey I managed to make it work using one of their functions:
    add_filter( 'wpgcl_filter_raw_gallery_link_url', 'qtrans_convertURL');

    it’s perfect, you saved me hours of work, I thank you so much!

    Glad to hear it ?? I’ll be pushing these updates as version 1.8.0 soon.

    Just as a side note, you might want to try something like this:

    add_filter( 'wpgcl_filter_raw_gallery_link_url', 'my_gallery_link_url_filter', 10, 3 );
    function my_gallery_link_url_filter( $link, $attachment_id, $post_id ) { return qtrans_convertURL( $link ); }

    It’s a little more flexible for the future, and less likely to throw incorrect number of arguments warnings, although I guess what you have seemed okay when I tested it.

    Thread Starter hisopio

    (@hisopio)

    Just tested it. Perfecto.
    Thanks again!

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘qtranslate?’ is closed to new replies.