Sorry so late, and so long a code, hope this is what you wanted…
I took out the code you recommended as it was not working…
get_header(); ?>
<div id="main">
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="gf-slider">
<!-- slider -->
<ul class="slides">
<li><a href="http://localhost/wordpress-4.1.1/wordpress/byers-solar/"><img src="http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/04/slider-image-4.png" alt="SunPower Solar" title="SunPower Solar"></a>
<p class="flex-caption">SunPower Solar</p>
</li>
<li><img src="http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/04/slider-image-3.png" alt="LeafGuard Gutters. No Leaks. No Glogs. No Cleaning. That's Byers!" title="LeafGuard Gutters. No Leaks. No Glogs. No Cleaning. That's Byers!" />
<p class="flex-caption">LeafGuard Gutters. No Leaks. No Glogs. No Cleaning. That's Byers!</p>
</li>
<li><img src="http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/04/slider-image-2.png" alt="Roofing Contractor Since 1987" title="Roofing Contractor Since 1987" />
<p class="flex-caption">Roofing Since 1987</p>
</li>
<li><img src="http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/04/slider-image-1.png" alt="Solatube Daylighting Systems | The smarter Alternative to Skylights" title="Solatube Daylighting Systems | The smarter Alternative to Skylights" />
<p class="flex-caption">Solatube Daylighting Systems | The smarter Alternative to Skylights</p>
</li>
</ul>
</div>
<div id="header-one-bar-full"><h1>The Best Investment for your home and Family. <span>That's Byers</span></h1></div>
<div id="header-one-bar-800"><h1>The Best Investment for your home and Family.<br /><span>That's Byers</span></h1></div>
<div id="the-content">
<div id="the-content-text">
<h3>Why Byers?</h3>
<p>For three generations — and counting, the Byers family has been in the business of keeping your family safe, warm, and dry with the highest qaulity gutters, roofing, and… people.</p>
<p>Our promise to you is that we are “<strong>The Best Investment For Your Home and Family. <span>Guaranteed</span>.</strong>”</p>
<p>Every new product and service we provide must meet our own time-tested set of standards before we will stake our family's namon it.</p>
<p>Is it industry leading technology?<br />Does it last a lifetime?<br />Will our staff continue to be the best trained staff?<br />Can we guarantee our clients' satisfaction everytime?</p>
<p>When we answer YES to these questions and more, it will make the cut, so you can rest assured that it truly is the best investment for your home and family.</p>
</div>
<div id="the-content-images">
<div class="brand-logos-full"><img src="http://localhost/wordpress-4.1.1/wordpress/wp-content/themes/byersenterprises/seals/ThatsByers-brand-logos.jpg" alt="Brand Logos | Good Housekeeping | GAF | Guild Quality | Owens Corning, LeafGuard, Solatube, Sunpowe, Angies List" width="100%" title="Brand Logos | Good Housekeeping | GAF | Guild Quality | Owens Corning, LeafGuard, Solatube, Sunpower, Angies List" /></div>
<div class="brand-logos-1024"><img src="http://localhost/wordpress-4.1.1/wordpress/wp-content/themes/byersenterprises/seals/ThatsByers-brand-logos-b.jpg" alt="Brand Logos | Good Housekeeping | GAF | Guild Quality | Owens Corning, LeafGuard, Solatube, Sunpowe, Angies List" width="100%" title="Brand Logos | Good Housekeeping | GAF | Guild Quality | Owens Corning, LeafGuard, Solatube, Sunpower, Angies List" /></div>
<div class="brand-logos-800"><img src="http://localhost/wordpress-4.1.1/wordpress/wp-content/themes/byersenterprises/seals/ThatsByers-brand-logos.jpg" alt="Brand Logos | Good Housekeeping | GAF | Guild Quality | Owens Corning, LeafGuard, Solatube, Sunpowe, Angies List" width="100%" title="Brand Logos | Good Housekeeping | GAF | Guild Quality | Owens Corning, LeafGuard, Solatube, Sunpower, Angies List" /></div>
</div>
<div class="clear open"></div>
<?php
$leaf = "leaf";
$roof = "roof";
$solar = "solar";
$solatube = "solatube";
$OfferBox1Product = get_field('offer_box_1_product');
$OfferBox2Product = get_field('offer_box_2_product');
$OfferBox3Product = get_field('offer_box_3_product');
{if ($OfferBox1Product == $leaf) {$OfferBox1Color = "30,134,72"; $OfferBox1Image = "http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/06/byers-offer-leafguard-320x122.png"; $OfferBox1ImageDescription = "LeafGuard Gutters - Sacramento, Bay Area";}
elseif ($OfferBox1Product == $roof) {$OfferBox1Color = "25,130,197"; $OfferBox1Image = "http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/06/byers-offer-roofing-320x122.png"; $OfferBox1ImageDescription = "Roofing Contractor - Sacramento, Bay Area, Northern California, GAF, Owens Corning";}
elseif ($OfferBox1Product == $solar) {$OfferBox1Color = "246,191,22"; $OfferBox1Image = "http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/06/byers-offer-solar-320x122.png"; $OfferBox1ImageDescription = "SunPower Solar - Sacramento, Bay Area, Northern California, Solar Power";}
elseif ($OfferBox1Product == $solatube) {$OfferBox1Color = "25,130,197"; $OfferBox1Image = "http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/06/byers-offer-solatube-320x122.png"; $OfferBox1ImageDescription = "Solatube Daylighting Systems better than Skylights - Sacramento, Bay Area, Northern California";}}
{if ($OfferBox2Product == $leaf) {$OfferBox2Color = "30,134,72"; $OfferBox2Image = "http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/06/byers-offer-leafguard-320x122.png"; $OfferBox2ImageDescription = "LeafGuard Gutters - Sacramento, Bay Area";}
elseif ($OfferBox2Product == $roof) {$OfferBox2Color = "25,130,197"; $OfferBox2Image = "http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/06/byers-offer-roofing-320x122.png"; $OfferBox2ImageDescription = "Roofing Contractor - Sacramento, Bay Area, Northern California, GAF, Owens Corning";}
elseif ($OfferBox2Product == $solar) {$OfferBox2Color = "246,191,22"; $OfferBox2Image = "http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/06/byers-offer-solar-320x122.png"; $OfferBox2ImageDescription = "SunPower Solar - Sacramento, Bay Area, Northern California, Solar Power";}
elseif ($OfferBox2Product == $solatube) {$OfferBox2Color = "25,130,197"; $OfferBox2Image = "http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/06/byers-offer-solatube-320x122.png"; $OfferBox2ImageDescription = "Solatube Daylighting Systems better than Skylights - Sacramento, Bay Area, Northern California";}}
{if ($OfferBox3Product == $leaf) {$OfferBox3Color = "30,134,72"; $OfferBox3Image = "http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/06/byers-offer-leafguard-320x122.png"; $OfferBox3ImageDescription = "LeafGuard Gutters - Sacramento, Bay Area";}
elseif ($OfferBox3Product == $roof) {$OfferBox3Color = "25,130,197"; $OfferBox3Image = "http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/06/byers-offer-roofing-320x122.png"; $OfferBox3ImageDescription = "Roofing Contractor - Sacramento, Bay Area, Northern California, GAF, Owens Corning";}
elseif ($OfferBox3Product == $solar) {$OfferBox3Color = "246,191,22"; $OfferBox3Image = "http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/06/byers-offer-solar-320x122.png"; $OfferBox3ImageDescription = "SunPower Solar - Sacramento, Bay Area, Northern California, Solar Power";}
elseif ($OfferBox3Product == $solatube) {$OfferBox3Color = "25,130,197"; $OfferBox3Image = "http://localhost/wordpress-4.1.1/wordpress/wp-content/uploads/2015/06/byers-offer-solatube-320x122.png"; $OfferBox3ImageDescription = "Solatube Daylighting Systems better than Skylights - Sacramento, Bay Area, Northern California";}}
?>
<!--
== OFFERS (3 BOXES)
-->
<div id="offers">
<h3>Latest Offers</h3>
<a href="<?php the_field('offer_box_1_link') ?>"><div class="offer" style="background-color: rgba( <?php echo $OfferBox1Color ?>, 1.00);">
<?php the_field('offer_box_1_content'); ?>
<img class="offer-image" src="<?php echo $OfferBox1Image ?>" alt="<?php echo $OfferBox1ImageDescription; ?>" title="<?php echo $OfferBox1ImageDescription; ?>" />
</div></a>
<div class="offer-space"> </div>
<a href="<?php the_field('offer_box_2_link') ?>"><div class="offer" style="background-color: rgba(<?php echo $OfferBox2Color ?>, 1.00);">
<?php the_field('offer_box_2_content'); ?>
<img class="offer-image" src="<?php echo $OfferBox2Image ?>" alt="<?php echo $OfferBox2ImageDescription; ?>" title="<?php echo $OfferBox2ImageDescription; ?>" />
</div></a>
<div class="offer-space offer-space-third"> </div>
<a href="<?php the_field('offer_box_3_link') ?>"><div class="offer" style="background-color: rgba(<?php echo $OfferBox3Color ?>, 1.00);">
<?php the_field('offer_box_3_content'); ?>
<img class="offer-image" src="<?php echo $OfferBox3Image ?>" alt="<?php echo $OfferBox3ImageDescription; ?>" title="<?php echo $OfferBox3ImageDescription; ?>" />
</div></a>
</div>
<div class="open"></div>
<!--
== CLIENT TESTIMONIALS
-->
<div id="client-testimonials">
<div class="client-testimonial-half">
<div class="the-testimonial"><?php the_field('client_1_testimonial'); ?></div>
<p class="client-info"><span class="client"><?php the_field('client_1_name'); ?></span><br /><?php the_field('client_1_city'); ?><br /><?php the_field('client_1_date'); ?></p>
<img style="display: <?php the_field('display_client_1_image');?>;" src="<?php the_field('client_1_image'); ?>" alt="<?php the_field('client_1_image_description'); ?>" title="<?php the_field('client_1_image_description'); ?>" />
</div>
<div class="client-testimonial-half half-right">
<div class="the-testimonial"><?php the_field('client_2_testimonial'); ?></div>
<p class="client-info"><span class="client"><?php the_field('client_2_name'); ?></span><br /><?php the_field('client_2_city'); ?><br /><?php the_field('client_2_date'); ?></p>
<img style="display: <?php the_field('display_client_2_image');?>;" src="<?php the_field('client_2_image'); ?>" alt="<?php the_field('client_2_image_description'); ?>" title="<?php the_field('client_2_image_description'); ?>" />
</div>
</div>
<div class="clear"></div>
</div>
<?php the_content(__('(more...)')); ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, we could not find the post you are looking for.'); ?></p>
<?php endif; ?>
</div>
</div>
<div id="delimiter"></div>
<?php get_footer(); ?>
Hi John,
Thanks for your response.
I had to move forward with just setting up a separate field group for the response posts and looping through that and the original post in the page template. Not quite as elegant as what I was hoping for, but it works and doesn’t have any of the potential issues that you warned about!
Thanks again.
Hi,
first of all thank you for taking the time to answer my question. But I think, I did not explain myself well enough. The problem is not to get the file somewhere in the theme, after its saved, repeater or not. I need to hook into the moment when the file was uploaded, but BEFORE the data of the field set is stored into the database.
In other words: I create a post, populate the acf fields and click the save post button. That’s where the mumbo jumbo should happen: Create and store a preview file, move the uploaded file to another location, where it is not accessible by the public, give the file path of the newly created preview mp3 as the new value to the former file upload field and finally save the post and all it’s meta data.
Does that makes it somewhat clearer? Is there any hook, that I could make use of?

Hi @ceebeez
I’ll make a Bug issue on the Github repo so Elliot can take a look for a future update!
Thank you for noticing this!
A question for you, does it matter what fields you’re setting to 50%? Is it the same wether it’s a text field or an image upload field for example.
Did you ever solve this?
I’m having a related but slightly different issue. I’m using ACF in conjunction with the Events Manager plugin. If a user forgets to fill out one of the required Event fields, it prompts an error. When that happens, all of my ACF fields clear. It’s only the ACF fields — other fields are fine. It also only happens with ACF Pro, but not with ACF 4.x. The issue happens even with all other plugins deactivated and using the default WP theme.

Hi @sixtyseven from Germany 🙂
I’ll respond in the same manner as the questions asked:
a) In the settings for the file field you’ll find “Allowed file types”. Enter mp3 there and you should be good to go!
b) You can get the file wherever you want using get_field(‘filename’). But since your file field is in a repeater you could do:
<?php
$repeater = get_field('repeaterfield');
if( $repeater ): foreach( $repeater as $row ):
//$file contains either a file array, url or ID depending on what you've set in the field settings.
$file = $row['filefield'];
//Now you're free to play around with $file :)
endforeach; endif;
?>

Hi @sixtyseven
Thank you for the tip! It’s great to see people sharing what they’ve learned! 🙂
I’m not sure why you wouldn’t want to use a search-enhancing plugin like relevanssi or searchWP? They provide quite a bit more than just the ability to search meta etc. such as fuzzy matching and stopwords to name a few.
I’m always using a search-plugin for any site that utilise search.

This is extremely odd, when you try to use “IN” WP does not detect that there is an array stored in the field, it’s looking for multiple meta value rows in the database. When you attempt to have WP treat it as a string with “LIKE” it then decides to detect that there is an array (serialized) stored in the field.
WP has been doing some work on the meta queries to allow for the new clauses for meta_query https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query/
Try forcing the field type to “CHAR”
array(
'key' => 'banner_cats',
'value' => $pagecategories,
'compare' => 'LIKE',
'type' => 'CHAR',
),
I’ve found a “round-a-bout” way to do this… I run the query without the banner_cats and banner_towns conditions (and get rid of the posts_per_page). This will pull alot more results… Then, during the while loop, I check each post for an array_intersect for each meta keys. Since I only want 1 result, I break the loop if one is found.
While the solution works, I’d prefer to do this during the query process (to save resources)
The two trim errors are coming up when the two keys are involved (banner_cats and banner_towns). So, if I remove one of those arrays from the query, only one trim error occurs. Both of those keys are multi select fields in acf.
When I print the $pagecategories array (to check it), I get…
Array
(
[0] => 1
)
When I print $currenttowns array, I get…
Array
(
[0] => 1
[1] => 3215
)
So, I have one array (i.e. $currenttowns) comparing to the select field array (i.e. banner_towns) … can I not do that? I need to see if any of the fields in the arrays match, if so, then the query should call that post.
W0000t?!? :O
Its a taxonomy field and looks like this
array (
'key' => 'field_55411b948f60d',
'label' => 'Select Story',
'name' => 'story_post',
'prefix' => '',
'type' => 'taxonomy',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'taxonomy' => 'story',
'field_type' => 'select',
'allow_null' => 1,
'add_term' => 1,
'load_save_terms' => 1,
'return_format' => 'id',
'multiple' => 0,
),
Can you share your example?

That’s odd. It seems that WP is saying that it’s seeing one of those fields as an array.
Can you do some testing, just do one of the meta queries at a time and figure out which one is causing the error?

Not a problem. There are a few people now working the forums to answer questions and one of my goals is to clean up old questions. Next time you have a problem is should get quicker attention.

Yes, Elliot is trying to rectify the problems, which is why me an a couple of others are now working the forums. One of my goals is to clean up old questions and I know in many cases that the problem will be either non-existent or solved in some other way.
All I can say is that in the future questions get faster attention.

Trying to clear up some older questions here on the forum and wondering if you were able to work out what the trouble was. Let me know if you still need help with it.
~JH

treysea,
Are you still looking for help with this?
It is possible to construct a field group based on the selections made on another post. One would need to look at the code that is exported from a field group and how the individual fields are constructed. You can get the other post during the ‘init’ action and construct the new field group.
The hard and important part of what you are looking for is that the field names are the same and the the field keys are both unique and do not change each time the field group is constructed. I think that having a field group that changes constantly would be extremely hard to achieve in a way that would not loose data or cause other issues.
John,
Ok, thanks for getting back to me. I have resolved the issue above, but I have a new issue: I have a repeater that has gone haywire and is repeating into infinity!!!
Here is the page:
http://demo.bodiequirkdesign.com/all-about-ca-rainbow/assemblies-of-ca/
Here is the page template:
<?php
add_action( 'genesis_entry_content', 'rainbow_assemblies_of_ca' );
function rainbow_assemblies_of_ca() {
if ( have_rows('assemblies_of_ca') ):
while ( have_rows('assemblies_of_ca') ) : the_row(); ?>
<h2 class="decade-title"><?php the_sub_field('region_of_ca'); ?><h2>
<?php if ( have_rows('assemblies_of_ca') ): ?>
<table>
<thead>
<tr class="assemblies-row">
<td>City</td>
<td>Address</td>
<td>Meeting Times</td>
<td>Contact Person</td>
</tr>
</thead>
<?php while ( have_rows('assembly_info') ) : the_row(); ?>
<tr class="assemblies-row">
<td><?php the_sub_field('assembly_city'); ?></td>
<td><?php the_sub_field('assembly_address'); ?></td>
<td><?php the_sub_field('assembly_meeting_times'); ?></td>
<td><?php the_sub_field('assembly_contact_person'); ?></td>
</tr>
<?php endwhile; // end assemblies info ?>
</table>
<?php endif; // end assembly_info ?>
<?php endwhile; // end assemblies_of_ca ?>
<?php endif; // end assemblies_of_ca
} // End rainbow_assemblies_of_ca();
genesis(); // Initialize Genesis
// End of File
Can you see what is causing the repeater to never stop? I must be missing something simple, but I can’t see it.
Thanks!

Hi guys
Thanks for the feature request, I like it.
There is no way to optimize the loading without performing a wildcard LIKE sql query to get all options values, so I think the best solution here is to add a new setting which allows the auto_load to be set to true.
I’ll add this into the next version!
I’ve cleaned things up a bit… but now I’m getting an trim error from the meta.php file…
Here is the error..
Warning: trim() expects parameter 1 to be string, array given in /home/tipsfromtown/public_html/wp-includes/meta.php on line 1432
Since I’ve already closed this topic (cause the initial problem was fixed), and noone is responding to this thread anymore, I’ll open a new one with my code…
I think this issue was fixed by a subsequent update, but now it’s happening again from another recent update.
The Blank Message fix that I mentioned does fix it still.

The multiple nested meta queries all look good, quite well done, except for what I pointed out which is mostly just understanding out ACF actually stores some fields.
Hi John,
It is a plain textarea inside a group.
Here is a screenshot
You might see some invalid fields showing, that is because I was running ACF Field Validation plugin but disabled in to try and diagnose this issue.
More perplexing, after your response I created a new group with a single field being a text area and it worked. So I’m dumbfounded.

Well, it depends on what you consider undesirable. There are two things that you can do, one in the template and one in the admin.
In the template you can get the value of the radio field and then get the correct address field based on which is selected. This would be my preference since it requires the least amount of extra code.
In the admin you can create an acf/save_post action http://www.advancedcustomfields.com/resources/acfsave_post/ and in this function you can see what the value of the radio field is and then delete the contents of the other field.

Sorry for all the questions. I don’t usually have a problem doing the upgrade, but they sometimes happen.
Do you mean the field groups do not show up in the admin in the list of field groups? or that the fields do not show up on the post page?
If it’s the second, is it a post type edit page or an options page?

banner_cats is a multiselect field. This field will contain an array of category IDs and will be stored as a serialized array. You can’t do "IN" or "=" here.
To match this you need to do something like this:
array(
'key' => 'banner_cats',
'value' => '"'.$cat_id.'"',
'compare' => 'LIKE',
)
Notice the double quotes include in the value. This is so that 1 will only match 1 and not 10, 20.
To do something resembling an “IN” you would need to loop through the list of categories and create a “LIKE” query for each of them.
The reason that you get nothing is that the meta queries on banner_cats and banner_towns are retuning nothing.
Hope that helps.
~JH
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.