Skip to content
Advertisement

the_field – ACF not working in ‘while’ loop

Main string of code (that doesn’t work): <span class="price-in-kune"><?php the_field('tariff_price_kn') ?> kn</span>

JavaScript

enter image description here

The ways i tried to solve this problem:

  1. put insted of the_field('tariff_price_kn')echo('hi') – the code worked
  2. add $post_id -> the_field('tariff_price_kn', $post_id)
  3. $currencyKune = get_field('tariff_price_kn'); And then echo $currencyKune

P.S 3) i don’t know exactly where should i put $currencyKune = get_field('tariff_price_kn'), so i put it before while at first time – doesn’t work and at the second time i put it after $webTariffs->the_post();

Advertisement

Answer

Try this :

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement