Hi Elliot,
Thanks for the response!
Yes, I agree — it’s perfectly reasonable to suspect that post__in would be enough. The conflict occurs with another plugin that handles Event custom post types.
This events plugin uses the “pre_get_posts” method. During the process of using this method, the plugin will end up adding a tiny piece to the query if it has to do with a post_type that the plugin is responsible for. Ie, your query says “Give me all post types” and then the event plugin says “hey, that query has to do with events — so add on this event-related piece”. The end result is that the query doesn’t return anything because the event piece isn’t appropriate to be added in this case since it’s not really about events.
I’ll be the first to admit that there’s probably something that could change in the event plugin to avoid this issue. Having said that, my guess is that ACF is more widely supported than the other and therefore, more likely to be updated. Plus, I figured the update actually made sense anyway to restrict the results to certain post_types. Especially, since it was already filtering to certain post_types anyway, it just wasn’t being that specific.
What do you think?

Hi @eablokker
Thanks for the bug report.
Can you please change this topic to a quest so it can be marked as solved when fixed?

Hi @AboHitham
Can you change this topic type to a ‘question’, then mark it as solved?
Thanks
E
Hello, guys,
I thought that my issue involved the PHP version my server had installed. I asked the host to upgrade me to 5.3 at least.
This upgrade worked…spottily. I could then get the format to change, mostly, but then I started having issues with the custom fields themselves; I would use the datepicker to choose a date, update the post, and the date would disappear. I would also get a fatal error: “Call to a member function format() on a non-object” on the posts that did have dates attached to the field. When I was lucky, the formats were changed perfectly (using the PHP code suggested on the DatePicker reference page on this site), but in the end I had to set the field to “text” instead of “datepicker” because I couldn’t guarantee success.
@cerulean or others like him/her – I’d definitely check to see what version of PHP your server is running. If it’s below 5.3 the “DateTime::createFromFormat” code won’t work. Upgrade and it might fix your issue!
@elliot, or others – can you point me to a piece of jQuery that you know works to change the datepicker format? And perhaps let me know what I need installed on my site as well (jQuery, jQuery UI, perhaps)?
Many thanks, Matt
Hi
Interestingly only a day later than the last post I came looking for an answer to exactly the same question. I seem to have solved the problem, well at least for myself I have in this way…
function posts_for_current_author($query) {
if( !$query->is_admin )
return $query;
$screen = get_current_screen();
if ($screen->base === 'post')
return $query;
if( !current_user_can( 'moderate_comments' ) ) {
global $user_ID;
$query->set('author', $user_ID );
}
return $query;
}
Essentially this checks to see if you are in admin
Then the critical bit for ACF it looks to see if you are editing a page which is the screen->base === ‘post’ bit. That will return the standard query since the mod to user_ID in the query loses the ACF fields.
Like I said this works here and I should be grateful if you can let me know if it works for you too.
By the way I have additional code to change the headings on the list of posts since it shows all and published even though you can’t see them.
All the best
I fix it,
It’s because another plugin add duplicate jquery library.
Thank you.
Nevermind, the following worked:
<?php
// vars
$queried_object = get_queried_object();
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
// load thumbnail for this taxonomy term
$thumbnail = get_field('background_image', $taxonomy . '_' . $term_id);
echo $thumbnail;
?>
ohhh closer
this works except the permalink is outside of the link
<ul>
<?php
$i = 1;
while(has_sub_field('question_answer')):
echo '<li><a href="' . the_permalink() . '/item-' . $i . '">' . get_sub_field('question') . '</a></li>' ;
$i++;
endwhile;
?>
</ul>
This does not display anything….
<ul>
<?php
$i = 1;
while(get_sub_field('question_answer')):
echo '<li><a href="' . the_permalink() . '/item-' . $i . '">' . get_sub_field('question') . '</a></li>' ;
$i++;
endwhile;
?>
</ul>

Thanks for the detailed description.
I would have through that the post_type param would not be needed due to the post__in param being so precise.
Can you explain the issue with more detail on why the current query doesn’t work, even through the ID’s are explicitly set?
Thanks
E

Hi @Studioworks
Thanks for the bug report. You must have downloaded the update within a minute of the upload.
I also experienced this after I tested the update and quickly fixed the issue.
For some reason, the git deployment messed up the file.
Sorry for the inconvenience caused.
* You can remove all the code after ?>
Cheers
E
awesome.. I implimented that like this:
<?php
$i = 1; while(has_sub_field('question_answer')): echo '<div id="item-' . $i . '"><h2>' . get_sub_field('question') . '</h2>' . get_sub_field('answer') . '</div>';
$i++;
endwhile;
?>
now i am attempting to link to the anchor form another template.
<ul>
<?php
$i = 1;
while(has_sub_field('question_answer')):
echo '<li><a href="' . the_permalink() . '/item-' . $i . '">' . the_sub_field('question') . '</a></li>' ;
$i++;
endwhile; ?>
</ul>
this is rendering the right code, just jumbling the html.. i checked the order so it must be my lack of php skills

Try using meta_query and specifying ‘type’ => ‘DATE’. Or you could try using “meta_value_num” as the ‘orderby’ argument, but I can’t remember if this works or not. See: http://codex.wordpress.org/wp_query#Custom_Field_Parameters
i ran some tests and the problem is that the value is now saved as an array even if there is only one value. this causes issues for plugins doing things with custom fields and expecting strings. also support for arrays is limited in custom queries…

Hi,
I have added my custom CSS for now, and it looks better: http://imgur.com/qx6Gw5e and it’s more user friendly.
I think 33% option would do fine.
BR
Vlado
I found it… The file is stored in the wp_posts table as a post_type of attachment and a post_parent ID of the record in question. I think I’m still missing something, though, because I still don’t see how it is tied to the field itself…
Hi elliot,
I met the same problem. But my backend is in Chinese. Could post the detail solution here? Or could you just send it to me? I set equal or not euqual, the fields show up in all posts all categories.
Urgent!…Could you help me out? Thank you in advance.

The subfields doesnt really have a specific ID.. However you can do a loop counter in your while(has_sub_field()) and use that to create custom ids..
example:
<?php
$i = 1;
while(has_sub_field('myfield')):
echo '<div id="item-' . $i . '">' . get_sub_field('mysubfield') . '</div>';
$i++;
endwhile;
?>
This will give your items an id of item-1, item-2 etc. so in your anchor you can do:
<a href="#item-2">link to second item</div>

Hey guys.
After a quick test, I can’t replicate the issue at all.
The value ‘1’ is saving perfectly as a default value and as a normal selection.
Is it possible that you have another field with the name field_name on the edit screen? This would cause the value to be overridden.
Is it also possible that some sort of PHP error is occurring which is stopping ACF from saving completely?

Hi @Mike Rodriguez
The issue is that every time ACF fires the ‘acf/setup_fields’ event, you are applying jQuery events to ALL elements which match your selection.
You should be targeting only elements which exists WITHIN the $(postbox)

Hi @bobz
Thanks for the feedback.
I think for now, I would advise you to add this in via custom jQuery in your wp-admin.
This is getting a git specific for the core of the plugin.
Cheers
E

Oh, that Settings API! Yes, that would be an interesting implementation.
I’m actually not using FontAwesome. I looked into it and it’s great, but I ultimately went with Icomoon
I’m actually having trouble with the plugin inside repeater fields, flex-fields, and two to a page. Perhaps you can take a look? http://support.advancedcustomfields.com/forums/topic/jquery-conflict-with-repeater-flex-fields-creating-own-field-type/

In response to your first request, I just created a Icon Library field that should be out in a day or two after I finish debugging it.
What do you mean by a Setting’s API? Can you elaborate a bit more on this? I’m interested in seeing what you mean by that.
As for the other fields, you could create your own field or extend some of the fields already created, have you taken a look at creating your own field type in the documentation? http://www.advancedcustomfields.com/resources/tutorials/creating-a-new-field-type/
Hi Jonathan and thanks for your quick reply.
I have set the image field to ID. But after your reply I checked the code again and found the error.
I had used the_sub_field instead of get_sub_field.
So thanks for validating that your solution also worked on sub fields that pointed me in the right direction.
I saw your answer in this topic (http://support.advancedcustomfields.com/forums/topic/how-to-use-alt-tags/) and used the last solution you provided.
Final code that worked for me.
Code added to function.php
// Alt text for ACF get_sub_field images
function get_image_with_alt($imagefield, $postID, $imagesize = 'full'){
$imageID = get_sub_field($imagefield, $postID);
$image = wp_get_attachment_image_src( $imageID, $imagesize );
$alt_text = get_post_meta($imageID , '_wp_attachment_image_alt', true);
return '<img src="' . $image[0] . '" alt="' . $alt_text . '" />';
}
And then all it like this where you want the image in your template:
<?php echo get_image_with_alt('NAME OF THE IMAGE FIELD', get_the_ID(), ''); ?>
Hi Jonathan and Wells5609;
I’m getting more and more lost! Lol. Basically the posts which has selected a certain Company custom post shows up beautifully as “related posts” in that Company’s single-company.php using this query on my single-company.php.
However I’ll require a link to “View More” after showing only 3 posts as related posts which should point to an archive page of posts which has the Company selected.
Like Jonathan said, “since there’s no default archive for posts queried by meta value”, I am stuck 🙁 Unfortunately, his solution yielded an error saying that no posts exist at the URL: http://example.com/companies/?company=225
Helppp D:
@wells5609 Awesome! You lead me to try something that got me to the answer.
I can’t do exactly what you said cause I needed to do the get_fields call for some other data. But, your answer prompted me to try:
$field = get_field_object($question, 'user_'.$userid, array('load_value' => false));
Essentially adding in the user_ID# instead of passing in FALSE. This did the trick for me. Not sure why I didn’t try that before!
Thanks!
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.