Random images with no duplicates (ACF Gallery) [closed]

Use array_unique() before foreach: Edited: <?php while ( have_posts() ) : the_post(); $images = get_field(‘gallery’); // thumbnail if( $images ): ?> <ul id=”container” class=”tiles-wrap animated”> <?php $images = array_rand($images); $images = array_unique($images); foreach( $images as $image ): // $rand_class = array(‘small’, ‘medium’, ‘large’); $size=”medium”; $thumb = $image[‘sizes’][ $size ]; $width = $image[‘sizes’][ $size . ‘-width’ … Read more

How can you query posts by advance custom field when the value is a serialized array? [closed]

I would advise using the built-in ACF functions for this. Elliot has provided a full toolbox for you and documentation for all field types: <?php // Conditional statement (Single Value) if(get_field(‘page_layout’) == “col_1”) { //… } //Conditional statement (Multiple Values) if( in_array( ‘col_1’, get_field(‘page_layout’) ) ) { //… } ?> Check out the ACF documentation: … Read more

Help using acf/save_post hook to connect to Untappd API and update_field [closed]

It’s because your require_once ‘Pintlabs/Service/Untappd.php’; is relative to “current” file and should be absolute path. I don’t know where are you using this hook but depending on location it should look something like this: ABSPATH is your wordpress root dir and ‘custom-path’ should be a path to Pintlabs dir require_once ABSPATH.’custom-path/’.’Pintlabs/Service/Untappd.php’; get_template_directory() if you use … Read more

Query and display only by first letter of the get_field value

Hope the below code block will help you. Please read the comments carefully. The code block- // Your previous code. // Say this is your $oder_terms variable $order_terms = array( ‘Sanchez’ => ‘Sanchez Link’, ‘Smith’ => ‘Smith Link’, ‘Dramatist’ => ‘Dramatist Link’, ‘Rashed’ => ‘Rashed Link’, ‘Munez’ => ‘Munez Link’, ‘James’ => ‘James Link’, ‘Jacky’ … Read more