Expire post to draft by date-picker custom field

ACF saves the value as Ymd format in database regardless of display and return format. All you need is a meta query to fetch the correct posts. function expire_posts_function() { //Get Expired Posts only $expired_posts = get_posts(arrasy( ‘post_type’ => ‘event’, ‘posts_per_page’ => -1, ‘post_status’ => ‘publish’, ‘meta_query’ => array( array( ‘key’ => ‘ev_date’, ‘value’ => … Read more

Populate select list with meta values from all posts of a Custom Post Type

Here is the solution I came up with, that works properly. <form method=”get” action=”” onchange=”submit();”> <div class=”input-group”> <?php global $wpdb; $meta_key = ‘item_oem’; $data = $wpdb->get_results($wpdb->prepare( “SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s”, $meta_key) , ARRAY_N ); ?> <select class=”custom-select” id=”oems” aria-label=”oems” name=”item_oem” > <option selected>Search By OEM</option> <?php foreach( $data as $value … Read more

Populating ACF Image Fields from JSON file

Yes it is possible to populates an acf gallery field from json data. Lets say this is your gallery json from your app… { “gallery” : [ “https://i.imgur.com/VHkyr8P.jpeg”, “https://i.imgur.com/obdqDwa.jpeg”, “https://i.imgur.com/eQuSNVx.jpeg”, “https://i.imgur.com/1lVyIJt.jpeg”, “https://i.imgur.com/5uIOviX.jpeg” ] } Now in your cron job you could run a function as shown below to handle acf gallery field image updates. My … Read more

ACF – get custom taxonomy term image field

I did it by this example: https://support.advancedcustomfields.com/forums/topic/loop-to-display-acf-image-of-taxonomy-term/ <?php $terms = get_terms( array( ‘taxonomy’ => ‘sluzba’, ‘hide_empty’ => false ) ); foreach ( $terms as $term ) : $term_image = get_field( ‘tax_image’, ‘sluzba_’ . $term->term_id ); ?> <div class=”col-lg-4 col-md-6″> <div class=”product product-zoom product–card”> <div class=”product__thumbnail”> <?php if ( $term_image ) : ?> <img src=”<?php echo … Read more