• Resolved douglasmikado

    (@douglasmikado)


    I have a loop showing events on a translated page. One page is in Dutch and the other one in English.
    Both pages show the events in the correct language but media is set as translatable and the image url is only showing in the English version. The original and translation use the same featured image.
    On the Dutch page the image url of the featured image stays empty. Can I somehow force the loop to grab the image set as featured image even if the featured image is in a different language?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Interesting. If I understand correctly, you’re using L&L to display both the text fields and the featured image field on both the English and Dutch versions of the page. Is that right? I would assume that if other fields are showing correctly and it’s simply the image field that isn’t, this might be an issue with the way your multilingual setup works, but it’s hard to know for sure without seeing what’s going on there. Are you using a plugin for that and if so, which one? You could try using <Field all /> on your Dutch template to see if the featured image still exists or if it happens to use a different field name in the translated version of the page.

    Maybe the easiest way to resolve this would be to give us access to your site if you’re willing by sending us some credentials to your site here with some information about which page is causing the issue and we’ll take a look.

    Thread Starter douglasmikado

    (@douglasmikado)

    The translation plugin is Polylang. It works fine until we enable the media module from Polylang. A language dropdown appears on every image in the media library and the featured image, still present on the teasers elsewhere on the site, disappear from the loops.

    Thread Starter douglasmikado

    (@douglasmikado)

    The Field image is still there on the Dutch version when I check the object. It also has the same ID in both languages.

    To test I put this in my loop:
    <div class=”tangible-bg-img”style=”background-image: url({Field image_url})”</div>
    <Field image />

    The image_url just returns empty string but strangely the <field image /> shows an empty bracket “[ ]”.

    Hope it helps. For now I disabled the media translations. If I find the time this week I will create a staging for you to have a look if this info did not help.

    Interesting. I think we’d need to take a look at the site in order to identify whether this is an issue with L&L or Polylang, so a staging instance would be helpful. We use L&L with WPML on our multilingual sites and that generally works great so my hunch is that this is a Polylang issue but we’d need to check to make sure.

    Hi again @douglasmikado, I just installed Polylang on a test site and enabled media translations and it seems that adding <Field image_url /> to a template located within a post that contains a featured image correctly displays the featured image URL in both translations of the post. So it seems this isn’t an issue with L&L or Polylang but likely either a conflict with another plugin on your site or a syntax issue with your template. I just took another look at the markup you mentioned writing in your template:

    <div class=”tangible-bg-img”style=”background-image: url({Field image_url})”</div>
    <Field image />

    If this is the exact markup you added to your template, then I think this is probably the issue. I can see directional quotation marks like when only straight quotation marks like " are valid characters in HTML syntax (and therefore L&L syntax too). I also noticed you don’t have spaces between your attributes, which is again an invalid HTML syntax. Could you try adding an L&L template to a translated post in both languages that only includes <Field image_url /> with no other markup and let me know if that currently displays the featured image URL in both languages?

    If that doesn’t solve it, you might want to try deactivating other plugins to determine if another plugin installed on your site might be causing this issue, since it doesn’t seem to exist for me with a fresh install that only includes L&L and Polylang.

    @douglasmikado Did you have a chance to look into the suggestions in my previous post? Let me know what you find out about potential conflicts with other plugins. My gut feeling is that neither L&L nor Polylang are the culprit here given that things are working for me on a fresh install with those two plugins. Let me know what comes up during your testing.

    Thread Starter douglasmikado

    (@douglasmikado)

    Hi @bentangible ,

    I have updated the plugin to v3.0.0 and added the space in the markup. (Quotes where ok on my end.)
    But the update and/or the valid markup fixed the problem. I can enable ‘media translations’ now. Thanks!

    Thread Starter douglasmikado

    (@douglasmikado)

    Unfortunately, the issue was not solved. The results where cached. Images still don’t show when media translations are on.

    I even found another issue with the translations and a custom taxonomy.

    When I enable the translations in Polylang for ‘Custom post types and Taxonomies’ and select my custom taxonomy then the loop does not show the titles anymore. Once I disable the the translations again the issue is fixed.

    This is my code in the loop:

    <ol>
      <Loop type=taxonomy_term taxonomy=timeslots>
        <li><Field title /></li>
      </Loop>
    </ol>
    • This reply was modified 2 years, 2 months ago by douglasmikado.

    @douglasmikado I just enabled custom post/taxonomy translations on my test Polylang site and created some translated taxonomy terms. When I use the markup you shared in your most recent comment, everything works as expected and my loop only displays taxonomy terms that are in the same language as the post on which I’ve placed my L&L template. It sounds like you might have a caching configuration issue here that isn’t related to either Polylang or Loops & Logic, which we can’t provide support for, unfortunately. Are you able to replicate this on a fresh WordPress installation that doesn’t have any client-side or server-side caching? Does this issue still occur when you disable all plugins other than Loops & Logic and Polylang? Those might be helpful things to test to determine what’s actually causing this issue on your site.

    To clarify: if this is an issue between L&L and your caching plugin or some other third plugin that isn’t working as expected, we could definitely look into that. But from the sound of it, it seems that this issue is only happening when you try displaying data from Polylang, which suggests that the issue lies between Polylang and this other plugin/caching solution. We couldn’t provide support for an issue between two third-party plugins. Let me know if you have any other info that could help me replicate this on my fresh L&L+Polylang WordPress site!

    Thread Starter douglasmikado

    (@douglasmikado)

    Hi Ben, thanks for the follow up. I have created a sandbox with only 3 plugins enables (elementor, tangible and polylang).
    The issue with the taxonomy was my mistake. Unfortunately the issue with the image remains. I will send you credentials to access the sandbox.

    Hi @douglasmikado, thanks for the link to your site! I took some time to read through Polylang’s own documentation for media translations and it looks like both L&L and Polylang are working exactly as they’re designed to work. The issue here seems to be that you’ve enabled media translation, but you haven’t translated your media. Here are the steps to translate your media:

    1. Go to your site’s media library
    2. Click on the image you want to translate
    3. Click “Edit more details” at the bottom right of the modal window
    4. Click the plus icon in the languages meta box to translate the media into your other language

    You’ll then be able to display data in both languages. I hope my support efforts have been helpful for you and that you’re now able to get the most out of our plugin!

    By the way, I thought I’d mention that you might find the Loops & Logic forum to be a better place to get product support in the future. It’s a much more active community than this support in the WordPress plugin repository and there are people with a broader range of skill sets that can help you out with all sorts of things. Hope to see you on the forum!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Translated media url not showing in loop’ is closed to new replies.