Hi @Elliot Condon . There isn’t any format_value in my functions.php. But when i’ve added the double false parameters you’ve suggested all missing fields are shown up again! Thanks!
But one follow up question. WHY do i have to use false, false
in that specific case? I never ran into that before in any of my use cases as well as the get_field documentation on your site ( http://www.advancedcustomfields.com/resources/get_field/ ) isn’t documenting nor suggesting its usage. So what do those false, false
actually do? Best regards Ralf
Hi guys
Just to confirm, the issue here is the inability to save a text value when the text value is an SQL command?
There has been no logic updates in ACF to explain this issue, but perhaps the issue stems from a recent WP update? Are you able to downgrade ACF and test older versions to see if this is the case?
Thanks
E
Have you tried it using a WP_Query? Like this for instance:
<?php
$speakers = get_field('speakers_two');
$query = new WP_Query(array(
'post_type' => 'speaker_info',
'post__in' => $speakers,
'meta_key' => 'last_name',
'orderby' => 'meta_value',
'order' => 'ASC',
));
if ($query->have_posts()) : ?>
<ul>
<?php while($query->have_posts()) :
$query->the_post();
?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<span>Custom field: <?php the_field('last_name'); ?></span>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
Let me know if it works or not, it did the trick for me with a relationship field I wanted to sort.
YES!!! it works, I placed it at the end of my shortcode and everything magically show up again. Mind telling me how wp_reset_query(); solve the issue?
Do you mean the "
is converting to ”
?
For instance if I have a custom size, and I want the admin to be able to select that size, or I want the return url to be that size no matter what, that would really helpful.
I might not be understanding correctly, but I’m not sure why you aren’t just doing this as part of your template file. That seems to be where this type of thing would belong.. You set up your custom image sizes, customer uploads a photo, WordPress makes all the respective sizes, and then you simply call the right size in your template file.
<?php $theimg = get_field('grid_image'); ?>
<img src="<?php echo $theimg['sizes']['customsizehere']; ?>" alt="<?php echo $theimg['alt'] ?>" />
If I’m missing something, can you clarify a bit more?
I made a feature request of this but because of another reason:
http://support.advancedcustomfields.com/forums/topic/restrict-relationship-fields-choices-to-current-user/
The following snippet gets all posts from a custom posttype “peoples” where the value of the ACF Field “assigned_team” is equal to the posts name.
$results = get_posts(array(
'numberposts' => -1,
'post_status' => 'any',
'post_type' => 'peoples',
'meta_query' => array(
array(
'key' => 'assigned_team',
'value' => $post->post_name
)
)
));
Is this what you are looking for?
nice one but this is the correct query:
// only show results with image in relationship field
add_filter('acf/fields/relationship/query', 'my_relationship_query', 10, 3);
function my_relationship_query( $args, $field, $post ){
$args['meta_query'] = array(
array(
// just check if this key exists:
'key' => '_thumbnail_id'
)
);
return $args;
}
thank you for leading me into the right direction!
try this
drop this lines:
$temp = $wp_query;
$wp_query = null; $wp_query = $temp;
and use this to reset query
wp_reset_query();
if needed i can add precisions, i don’t know if my request is very clear…
SOLUTION FOUND!
I used this after each while:
<?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
So the end product looks like this:
// Display ACF content for category a
<?php the_field('category_title_a'); ?
<?php the_field('category_content_a'); ?>
// Display posts from category a
<?php $my_query = new WP_Query( 'category_name=cat-name' );
while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
//extra stuff here
<?php endwhile; ?>
<?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
That seem to be my problem right now, i’m using a .sql database sent by my client.
I don’t have access to the actual database.
Deleting page and re-create all pages is not an option for me…
Hi @pagol,
Hmm… you could try passing the label as an argument in you query string too i.e.
http://your-domain.com/page-that-display-posts/?value=CK&label=CK Sunglasses
Then grab this value $label = $_GET['label'];
I’m not sure what sequence of events caused this issue but it was resolved by deleting a template file and adding it back again. No changes were made the file.
great! acf for ever <3 !
But this generates a frontend link. i need a link to the edit page of each item in the relationship field.
OR is there a better way to do this than this:
$link = '<a href="post.php?post='.$object->ID.'&action=edit">[edit]</a>';
I’ve managed to do a little further reading and found this (http://www.advancedcustomfields.com/resources/querying-relationship-fields/) which is close to what we need but it would be nice to rather manage this from the Option page instead of having a new Custom Post Type just for towns because there will be additional information elements we want to share across sections of the backend, not just towns.
Hi I just wanted to bump this feature request up. It would be very useful.
I haven’t tried the support email. I don’t think that Elliot is personally handling support any more. I remember him saying something along these lines in a video I watched (http://www.wpelevation.com/2014/07/episode-40-elliot-condon-advanced-custom-fields/). Since he’s not really watching these boards and he’s not personally doing support, not sure what to say except I guess I’m glad I haven’t needed to contact them.
I have access to the github repo and I watch that. I do see bugs there that are coming form support questions. I know that Elliot is working on things and generally responds to bug reports submitted there very quickly.
1) Don’t know the answer. I’m assuming that it will apply to all future version. On the other hand, I use it enough that if Elliot wanted another c note I probably wouldn’t hesitate.
2) I think your dev license would cover them taking control of a site you built. However, if this was me I’d likely deactivate my license. ACF will still work. If they want to get updates after that point then they’d need to buy their own license. Actually, I generally don’t leave my license active as a general rule. I’m the only one that updates sites I control so I just activate and deactivate as part of the update process.
Not sure if that helps, I’m just another user. To get official answers to your questions you might try [email protected]
Hey Hube2,
well actually the issue is that the team is very bad at responding to emails (support ticket). If they would answer those questions it wouldn’t be a problem, but they’re either not responding or they are responding in a month or so.
Jovana
How would you add a standard custom field to the order page in WooCommerce? You would basically do the same thing. Use the ACF field name as the name of the custom field. Only hitch might be if it is a field like a multiple select, checkbox or maybe a repeater.
How would you set a standard custom field’s value in a plugin action? Again, basically the same with ACF except that you also need to set a special custom field to tell ACF how the value is used. The special custom field name is equal to '_'.$field_name
and the value of this field is the ACF field key.
See this thread it shows why is happening and how to fix it.
Hi again!
Finally I edit my code and works!
This is the code:
<?php if(have_rows('otros_archivos')):
while (have_rows('otros_archivos')) : the_row();
$post_object = get_sub_field('antecedente');
if($post_object):
$post = $post_object; setup_postdata($post); ?>
<a href="<?php the_permalink(); ?>" target="_blank"><?php the_title(); ?></a>
<br/><br/>
<?php wp_reset_postdata();
else:
echo "<i>No se ha incluido ningún antecedente aún.<br/></i>";
endif;
endwhile;
endif; ?>
Anyway thanks for your help James.
I hope this code can help someone!
This is NOT solved. Just updated to the 5.1.7.1 three months later to this one-word patch has not been applied to the live code…after a customer received 150 duplicate emails from our site. So though the problem is “solved” the code is not fixed.
Why don’t you incorporate this one-word fix (posted above) into the code? If you would share the githib repo with @haroldkyle I would be happy to submit a pull request.
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.