• Resolved netschmiede24

    (@netschmiede24)


    Hi,

    I have a bilingual website that uses Pods for a number of different cases and I am having difficulties with the translations.

    • One pod is for brochures. It contains a field of the type “file > PDF”. This works fine in the original language (German) – but the translated item is not copying the PDF document. Even if I try to enter this field manually, it will not attach the file. What am I doing wrong?
    • Another pod is for events. It has two fields fo the type “date”, which are set to out the date in a specific date format (09.02.2026). However, the English page outputs the date in the format 2026-02-09, even if I specify {@date,d.m.Y} in the translated template.
    • On the German page I am calling the list via a Widget (Pods Element Listing). However, on the English pages, this Widget is not working. It says “Pod not found”. So I am using the Pods shortcode instead, which seems to work. Why is this?
    • The shortcode however does not seem to work in the events listing when I use the “orderby” statement. Why is this?

    Please help!

    Thanks,
    Astrid

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support pdclark

    (@pdclark)

    WPML File Attachments

    WordPress stores file attachments according to the ID of a particular post object, while WPML translates posts by changing the post object ID according to the user’s language.

    See WPML function documentation for wpml_original_element_id:

    $element_id would be the ID of the translated post object currently being viewed.
    $original_id (the value returned and stored in their example) would be the ID of the original post object, to which the PDF file is attached.

    If your file field is named pdf_file:

    WordPress core should return the URL of the file with:

    $file_url = wp_get_attachment_url( get_post_meta( $original_id, 'pdf_file', true ) );

    Or with Pods API:

    $file_url = pods( 'name_of_post_type', $original_id )->field( 'pdf_file' );

    Or Pods API displaying a link to the file:

    echo pods( 'name_of_post_type', $original_id )->display( 'pdf_file' );

    Formatting Functions

    The syntax for formatting functions is {@name_of_field,name_of_function}

    See Date Format Output Filter for Magic Tags for an example date format filter.

    If the function is named my_date, then add my_date to the comma-separated list Display callbacks allowed near the bottom of Pods Admin > Settings

    The linked example uses date() to specify one format. In multilingual contexts, WP’s date_i18n combined with WPML’s date format translation may be beneficial.

    Registering Page Builder Widgets

    This might depend on multiple things when translating within page builders…

    Generally, “Pod not found” means that the widget was unable to identity the Pod name automatically. Manually setting the widget’s “Pod name” might fix this, but if the theme or translation system are changing the context, it may or may not then have trouble identifying the ID of the specific object to display automatically if that is not set.

    On the Pods end, Pods needs to know what type of content to display (the Pod name, post type, taxonomy name), and what specific content of that type to display (the ID or slug of a post, a taxonomy term, or the result of a query).

    When translation systems or page builders rewrite or otherwise change the WordPress templating system, it can cause integrating plugins to need manual rewiring to identify what content goes where (things which would normally work automatically then require custom solutions).

    Some information on the requirements of WPML’s approach can be found at https://wpml.org/documentation/support/language-configuration-files/how-to-register-page-builder-widgets-for-translation/

    orderby

    Check the expected syntax of orderby at https://docs.pods.io/code/pods/find/ — it is a full MySQL orderby statement, not just a field name, e.g.,:

    t.post_name DESC
    t.post_date ASC

    …where t is the primary table being queried (wp_posts, wp_terms)

    name_of_date_field.meta_value ASC

    …where name_of_date_field is a custom field name, not prefixed by t.

    Thread Starter netschmiede24

    (@netschmiede24)

    Hi,

    thanks for your input. It didn’t help at first – but with a bit of fiddle, I managed to show the dates and PDF links as desired. I had to make sure to set Pods to not translateable and then reload and save the templates.

    Best,
    Astrid


Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.