Not displaying posts that are in the past. ACF date > date

You seem to be missing the meta_query proprety and looking at your code you seem to have two meta values mixed, so we need to combine them. $loop = new WP_Query([ ‘category_name’ => ‘gold’, ‘orderby’ => ‘rand’, ‘posts_per_page’ => -1, ‘meta_query’ => [ ‘relation’ => ‘and’, [ ‘key’ => ‘status’, ‘value’ => ‘active’ ], [ … Read more

Is there a better way of retrieving the name of an acf pagelink type from current post?

The page link field actually stores the post ID, which gets formatted internally by the get_field function on output. The 3rd argument for get_field lets you disable that output formatting so you just get the ID back, which you can then use to get title and permalink for that post: $post_id = get_field( ‘bookitall_roomstype’, false, … Read more

html element to separate php variable strings – ACF datepicker

thanks to @kero, i managed to do something like this : <?php $dayNumber = “l”; $weekDay = “j”; $month = “F”; $year = “Y”; $unixtimestamp = strtotime(get_field(‘date’)); ?> <?php echo ‘<span>’ . date_i18n($dayNumber, $unixtimestamp) . ‘</span>’; ?> <?php echo ‘<span>’ . date_i18n($weekDay, $unixtimestamp) . ‘</span>’; ?> <?php echo ‘<span>’ . date_i18n($month, $unixtimestamp) . ‘</span>’; ?> … Read more

ACF Add fields values to newly inserted post [closed]

You can do this instead of using update_field(): update_post_meta($post_id, ‘fieldname’, $value); update_post_meta($post_id, ‘_fieldname’, ‘field_’ . uniqid()); // `uniqid() is a native PHP function. This is also how ACF creates the field keys Also, depending where you are retrieving the value, you may also have to pass the post id. the_field(‘fieldname’, $post_id);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)