WPML + ACF how to set dynamic id of the page?

Good day guys, second day can't resolve the issue.
There are admin panel, on the main page using the plugin Advanced Custom Fields made fields to fill in contact information and displays them on the main and inner page. The output fields are written to the file footer.php as the contacts block through. The output is this:
<?php if( have_rows('contacts', 6) ): ?>
 <?php while( have_rows('contacts', 6) ): the_row(); ?>
 <div class="col-md-3 col-sm-6">
 <div class="item">

 <div class="location"><?php the_sub_field('adres'); ?></div>
 <div class="lodescr"><?php the_sub_field('ad_descr'); ?></div>
 <div class="map" id="<?php the_sub_field('mapid'); ?>"></div>
 <?php endwhile; ?>
 <?php endif; ?>

<?php if( have_rows('contacts', 6) ): ?>

Figure 6 tells what page to take the value for (6 - main page of the project).

Now about the problem.
The site has 4 languages, all translated and wpml for the English language creates a duplicate of the main page, therefore it id not 6.
Now all languages of the displayed contacts from the main page of Russian version of (id=6), and it is necessary to subject the language to be replaced by id in the call:
<?php if( have_rows('contacts', 6) ): ?>

How to implement it? :)

I would not want to create a new footer for each language version, I am sure that the problem is solved, but Google wasn't much help.
June 8th 19 at 17:07
1 answer
June 8th 19 at 17:09
Specifically in your case:
have_rows( 'contacts', apply_filters( 'wpml_object_id', 6, 'page' ) )

Read more in the documentation. Yes, they have it, though hidden very deep. Here is the main part of their documented API.

But in General, I would have gone the other way. Contacts you, you say, in the footer, sitewide. That is, are loaded on all pages. In this case, it is reasonable to do the Options page is enabled autoload parameter. First, it will be in settings and not in one of the pages that makes more sense. Secondly, due to the autoload data will be downloaded and cached, along with other options at an early stage, which means less unnecessary queries to the database (which are guaranteed, because you have the footer on all pages).
Thank you so much for the solution, and even more for the links! - nikita.Stracke commented on June 8th 19 at 17:12
health) - Velva.Rogahn commented on June 8th 19 at 17:15
Thank you!!! - raphaelle_Strosin53 commented on June 8th 19 at 17:18

Find more questions by tags WordPress