Hello John,
It still doesn’t work =(
with this: $value = get_field(‘valor1’);
I have: $0
With this: $value = the_sub_field(‘valor1’);
I have: 260000$0
Any idea?
By the way, thank you very much for your time
With the next code, I have $0
<?php $valor1 = get_sub_field('valor1');
if (intval($valor1) == $valor1) {
$valor1 = '$'.number_format(intval($valor1, ',', '.'));
}
echo $valor1;
?>
With the next code, I have: 260000$0
<?php if ( have_rows( 'valores' ) ) : ?>
<?php while ( have_rows( 'valores' ) ) : the_row(); ?>
<?php
$valor1 = the_sub_field('valor1');
if (intval($valor1) == $valor1) {
$valor1 = '$'.number_format(intval($valor1, ',', '.'));
}
echo $valor1;
?>
<?php endwhile; ?>
<?php endif; ?>
Thx
valor1= 260000 –> $260.000
valor2= example –> example
valor1 and valor2 can be number or text.
<?php if ( have_rows( 'valores' ) ) : ?>
<?php while ( have_rows( 'valores' ) ) : the_row(); ?>
<?php the_sub_field( 'valor1' ); ?>
<?php the_sub_field( 'valor2' ); ?>
<?php endwhile; ?>
<?php endif; ?>
Thx
Just a number: 260000
Thanks John!
But the results is $0
Any idea?
Thx
Thanks for your answer
I have and idea it’s possible to do this
With just PHP, show some field (can be whatever, text, image, etc) when the screen resolution is less than 640px and hide when is more than that.
Let me know and thank you very much!
Thank you John, work perfect!
Thanks John!
It works perfect, but with a little extra code 😉
<?php
if (have_rows('repeater')) {
$count = 0;
?><ul><?php
while(have_rows('repeater')) {
the_row();
if ($count > 0 && (($count % 2) == 0)) {
// skip the first one
// add list end/start whenever
// count is divisible by 2
?></ul><ul><?php
} // end if even
?><li><?php the_sub_field('sub_field_1'); ?></li>
<?php
$count++;
} // end while have rows
?>
</ul><?php
} // end if have rows
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.