Sort custom post type by custom datepicker instead of filtering

In meta_query, you missed the type of the field: $args = array( ‘post_type’ => ‘events’, ‘posts_per_page’ => ‘-1’, ‘meta_query’ => array( array( ‘key’ => ‘event_date_start’ , ‘compare’ => ‘>=’, ‘value’ => current_time(‘Ymd’), ‘type’ => ‘DATE’, ) ), ‘meta_key’ => ‘event_date_start’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’ );

How would i insert a value of custom field from Advaced Custom Field into shortcode generated by Gravity Forms [closed]

Yes, you can retrieve the saved meta value and pass it as a parameter to a shortcode. First option is to get the saved value to a variable, validate it and then concatenate it to a shortcode string you pass to do_shortcode(). // get saved meta value $form_id = get_field(‘your_key_for_form_id_here’); // make sure we have … Read more

How to check for duplicate record before saving a Custom Post Type

See this answer for solution, see comments there about error messages. That should work with Classic editor. It could work with Gutenberg too, but it would need additional effort to get correct error messages. UPDATE: If using classic editor and preventing publishing of invalid records is enough, you can use this code: function my_save_post($post_id) { … Read more

WP_Query not using custom taxonomy categories on custom post type

WP_Query only returns WP_Post objects for the results. To get the taxonomy terms for each post you need to use get_the_terms( $post, ‘recipe_categories’ ); for each post. This is because WP_Post represents each row of wp_posts, which does not include taxonomy information. The links between posts and terms is in the wp_term_relationships table.

Is it possible to create 2 unique titles for an Events custom post type: Upcoming Events and Past Events?

Try this: in archive-header.php line 8 – 10 by interecepting the variable “period=past” or ( I guess) “period = future” of current URL <?php else : if( !empty($_GET[‘period’] ) && $_GET[‘period’] == ‘past’) { echo “Past Events”; } elseif( !empty($_GET[‘period’] ) && $_GET[‘period’] == ‘future’ /*or whatever*/){ echo “Upcoming Events”; } else{ echo esc_html(lsvr_pressville_get_event_archive_title());//the default … Read more