Try removing the <div class="xzoom-thumbs">
from the loop.
<div class="col-left">
<div class="xzoom-thumbs">
<img class="xzoom" src="<?php the_field('preview_image'); ?>" xoriginal="<?php echo the_field('preview_image'); ?>" />
<?php
if( have_rows('main_gallery') ):
while ( have_rows('main_gallery') ) : the_row();
<a href="<?php the_sub_field('image_preview') ?>">
<img class="xzoom-gallery" width="80" src="<?php the_sub_field('image_thumb'); ?>" xpreview="<?php the_sub_field('image_preview'); ?>">
</a>
<?php
endwhile;
endif;
?>
</div>
</div>
Hey,
There is a php function called sort()
which is used to sort an array of values.
$cars = array("Volvo", "BMW", "Toyota");
sort($cars);
Might be of some use to you.
Hey,
If opening_hours and book_online are acf fields, then you can use
$book_online = get_field('book_online', $post->ID);
if(function_exists( 'iinclude_page' ) && $book_online)
{
//code here
}
You also need to make sure that the $post
and the function iinclude_page
is available.
Hey,
I really didn’t get the question, but rather than filtering it in the query, you can use this.
$posts = get_posts(array(
'post_type' => 'letters',
'numberposts' => -1,
));
foreach($posts as $post)
{
if(get_field('letter_sent', $post->ID) == '2019')
{
//your code
}
}
Also the meta_key is not same when acf saves it. Try enabling the Custom fields option in the Screen options. You will get the idea how acf saves the custom fields.
Hey,
You can add a single image field to get the first preview image and then add the repeater field to get all images.
See below.
<div class="col-left">
<img class="xzoom" src="<?php the_field('preview_image'); ?>" xoriginal="<?php echo the_field('preview_image'); ?>" />
<?php
if( have_rows('main_gallery') ):
while ( have_rows('main_gallery') ) : the_row();
<div class="xzoom-thumbs">
<a href="<?php the_sub_field('image_preview') ?>">
<img class="xzoom-gallery" width="80" src="<?php the_sub_field('image_thumb'); ?>" xpreview="<?php the_sub_field('image_preview'); ?>">
</a>
</div>
<?php
endwhile;
endif;
?>
</div>
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.