
Probably because Elliot updated the date picker field included in ACF to use WordPress built in.
Core: Made use of WP datepicker UI
in changelog: http://wordpress.org/plugins/advanced-custom-fields/changelog/
is there a reason why you cant use that instead of a third party extension?

Simply deleting the field from the ACF admin does not delete the meta data from the post. Try recreating the field ( be sure its the same field name) and go into the post and empty the fields value, save the changes, THEN go and delete the ACF field. Now you’ll have an empty meta value in the post and nothing should appear in the posts frontend + no more field.
Another way to do it would be to delete the meta value directly in the wp_postmeta table but I’m assuming you prefer not to tamper with that 🙂

Are you sure your logic is working? Also where does the get parameters come from (obviously the URL but how are they set there)?
Your date functions, shouldn’t they be set like the value saved in the database
date(Ymd); /Gives YYYMMDD
Also try setting the type value to DATE in the query.. (read the text here:http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters)

You could possible ditch the BETWEEN and instead use two meta queries, I’ve done this myself a while back. Here’s some code modified to your example
//gets all posts that has not yet ended
$args = array(
'post_type' => 'events',
'orderby' => 'date',
'posts_per_page' => 50,
'order' => 'ASC',
'orderby' => 'meta_value_num',
'meta_key' => 'start_date',
'meta_query'=> array(
array(
'key' => 'end_date',
'compare' => '>',
'value' => "$month_end_date",
)
array(
'key' => 'start_date',
'compare' => '<',
'value' => "$month_start_date",
)
)
);
$events = new WP_Query($args);

If you’re on a shared host its possible that your changes to max_input_vars does not apply.
Try contacting your server supplier and ask them if they can bump it up for you 🙂 I believe 1000 is the default value which you need to increase

It’s a purely CSS-issue.
Your current css on the recipy-boxes are:
width: 33.33%;
float: left !important;
margin-bottom: 30px;
With this CSS, if the boxes are not of equal height they will not appear on a clean row unless you put in like a clear:both after every three boxes before each new row (which does not work well when you want to change row-count for smaller devices). So instead try changing the css to this:
float:none !important;
margin-bottom:30px;
width:33%;
display:inline-block;
vertical-align:top;

Hi!
Not as is. The post object only retrieves posts from the current wp_posts table in the database. Each blog in a Multisite get’s their own wp_posts table.
You could add this code yourself .. I think best practice (without too much hassle) would be to in the field-file check if this is a multisite. If so output another option where when setting upp the field you choose from which blog to fetch posts.
Thing is that this would not allow you to retrieve posts from multiple blogs in the same post-object field. The issue with retrieving a lot of posts from many different blogs is mainly performance. For each post the code would have to switch over to a different wp_posts table and do another query.
I think you should have a look at the post indexer plugin from wpmudev: https://premium.wpmudev.org/project/post-indexer/

How have you used ACF?
The issue is probably that ACF does not allow for shortcodes to be rendered the way you want.

That should only give you 1 post?
You can also do this:
$args = array(
'numberposts' => 5,
'meta_key' => 'hp_slider',
'meta_compare' => '=',
'meta_value' => "1"
);

Hi @elliot
Ah okay. Sounds simple enough 🙂 What about the topic-marking (solved, solving etc.)? Is that a custom piece of code too? Seeing as You’d need to get the status of the post as well as the “solved my question” post saved into the database and retrieved on page load.

No problem 🙂
Honestly I have no idea how to undo it.. I’ve never made a question here myself =P

Most likely post revisions messing with the code. Add this right at the beginning of your function
if (wp_is_post_revision( $post_id ) ){ return false; }Â

You’re welcome 🙂
Perhaps you could set the proper correct answer. I help people out to give back but it’s also nice to get acknowledged for it 🙂

Well first you’ll want to replace
if(get_post_type($post_id) == 'your specific post type'){
“your specific post type” with the actual post type slug.
Then you want to add in all of your fields in the right order to the new_content variable:
$new_content .= 'this is the beginning of the content and heres my first field'. $fields['fieldname']['value'] . '. Doesnt it look marvelous!';
$new_content .= ' Here's some more stuff added on to the content:'. $fields['fieldname']['value'] . ' and ' . $fields['fieldname']['value'];
The problem is that I don’t know what the $fields variable look like so in order for you to find out you can do this:
print_r($fields);
die();
put it right after
$fields = $_POST['fields'];
when you save a post you’ll get a blank screen with the values of $fields.

Have you put the code inside of the loop? The loop is the while loop looking something like:
<?php while(have_posts()): the_post(); ?>

Ah okay ..
Well I think this should do it..just change some of the content for your own!
function my_acf_save_post( $post_id ){
if(get_post_type($post_id) == 'your specific post type'){ //just for good measure so it doesn't run on unnecessery posttypes
// vars
$fields = false;
// load from post
if( isset($_POST['fields']) ){
$fields = $_POST['fields'];
$new_content = '';
//add all of your content to $new_content
$new_content .= 'blah'. $fields['fieldname']['value'] . 'blah'; //not sure if Im getting the fieldvalues correctly
// Update post
$my_post = array(
'ID' => $post_id,
'post_content' => $new_content
);
// Update the post into the database
wp_update_post( $my_post );
}
}
}
// run after ACF saves the $_POST['fields'] data
add_action('acf/save_post', 'my_acf_save_post', 20);
EDIT: I think this might result in an infinite loop.. if so try this instead:
function my_acf_save_post( $post_id ){
if(get_post_type($post_id) == 'your specific post type'){ //just for good measure so it doesn't run on unnecessery posttypes
// vars
$fields = false;
// load from post
if( isset($_POST['fields']) ){
$fields = $_POST['fields'];
$new_content = '';
//add all of your content to $new_content
$new_content .= 'blah'. $fields['fieldname']['value'] . 'blah'; //not sure if Im getting the fieldvalues correctly
// Update post
$my_post = array(
'ID' => $post_id,
'post_content' => $new_content
);
// Update the post into the database
remove_action('acf/save_post', 'my_acf_save_post', 20);
wp_update_post( $my_post );
add_action('acf/save_post', 'my_acf_save_post', 20);
}
}
}
// run after ACF saves the $_POST['fields'] data
add_action('acf/save_post', 'my_acf_save_post', 20);

Why do you want to do that?

Ah I see 🙂
We’ll then I’ll settle for the glory ey! ;P

I would suggest that you create a custom post type called “soccer fields”. Google custom Post type UI and you’ll find an easy to use plugin.
Then add a ACF field with a dropdown where the user can select either open or closed.
Then to output the soccer fields check out this: http://codex.wordpress.org/Class_Reference/WP_Query
and in the loop you can retrieve the open/close dropdown value using get_field or the_field and output along with any other info about the soccer field..
I’m afraid that’s the best I can do for you since this question is faaaar to general. However if you look into what I’ve given you and you are capable of doing a bit of coding you should be fine!

do it just like you would any other variables..
$height = floatval(get_field('height'));
$width = floatval(get_field('width'));
$price = floatval(get_field('price'));
$total = floatval(get_field('total')); //not neccessery, gets calculated.
$total = ($width * $height) / $price;
echo $total;

Hi!
1. No, you dont have to add anything to functions.php
2. you cannot use the_secondary_content() unless that’s a function you’ve created yourself..
In order to output the value of the field you can use either:
echo get_field('secondary_content');
//or
the_field('secondary_content');
and this should work if you put it inside your loop as long as it’s a standard loop and not just a foreach or something.
Are you certain that the “who we are” page uses page.php and not a custom template?

Hi!
How many subfields do you have?! 😉
I’m not sure but I can’t see a reason why elliot would’ve put in a limit for subfields so what happens would probably be your php memory limit not keeping up.

Haha that’s true.. kind of making a mountain out of a molehill.. 😉 But still, overcoming issues like these is what makes this job fun!
Yeah I suggest you try my last solution, according to my brains logic it should work in it’s simplicity!
Unfortunately I don’t have a paypal account since I rarely use paypal in my private life and usually just get the glory and appreciation of helping out!
But I don’t suppose you’ll be at the wordcamp europe this weekend?

You can fetch the image url with javascript and print it as an img tag..
I can’t say for sure how to get the image url since I cant see your setup in admin but try to figure out how to get it by:
var imgURL = $('your image object').attr('href');
//Then print it in your popup doing something like this (again, you'll have to change the target object to be correct
$('target object popup').append('<img src="' + imgURL + '" alt="" class="targetimage" />');

Odd that your previous function didn’t work..
I tried thinking outside of what you’ve done so far and perhaps this would work? It’d be a lot simpler altho maybe not as good performance-wise.. I don’t think it matters tho since it’s in the admin and it’s not that big off a loss that anyone would notice.
function my_acf_save_post( $post_id )
{
//The fields have already been saved to the database so lets retrieve them
$event_start = get_field('field_5217ac66687dc', $post_id);
$event_end = get_field('field_524b4ca5ff418', $post_id);
//check if event_end exists, if it was empty it should not. You can make sure of this in database.. perhaps it has to be changed to $event_end == ''
if(!$event_end){
//update event_end. Parameters are field key of event_end, event_start value and the post id.
update_field('field_524b4ca5ff418', $event_start, $post_id);
}
}
// run AFTER ACF saves the $_POST['fields'] data to database
add_action('acf/save_post', 'my_acf_save_post', 20);
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.