Support

Account

Home Forums General Issues Get values from another page (WPML)

Solved

Get values from another page (WPML)

  • Hi and thank you for your time!

    On the website I am currently working on, I am using the function to retrieve values from another page in that format: <?php the_field(‘intro_text’, $homepage); ?>

    However I am working with WPML so the value of $homepage is different (French, English, Spanish) so I created 3 different variables to reflect that: $homepage_fr, $homepage_en and $homepage_es. I would like to know if it is possible to do this in some way (I am not a backend developer haha):

    <?php the_field(‘intro_text’, $homepage_LANG_CODE); ?> so that the right ID is shown at the end of $homepage.

    Thank you! 🙂

  • An idea came across my mind, since those fields are on the homepage (front page), I stored the front page ID in a variable like so:

    $homepage = get_option(‘page_on_front’);

    Everything works now! 😀

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

You must be logged in to reply to this topic.