How to display Custom Post Type Post based on Tag with Shortcode Parameter?

This is an answer that depending on how you ultimately configure things – should get you where you want to go. In your question, you had posts_per_page as 1. If you only want 1 result, then that’s fine. If not… modify as shown. You also didn’t initialize the concatenated string $return_string and finally you put … Read more

How To Fix WP Query Returns Results But Shouldn’t?

Couple of things to consider here: 1.) Try adding the meta query only if the value is present: $pairedThing = get_field(‘myThing’); $args = [ ‘posts_per_page’ => 2, ‘post_type’ => ‘thing’, ]; if ( ! empty( $pairedThing ) ) { $args[‘meta_key’] = ‘identifier’; $args[‘meta_value’] = $pairedThing; } 2.) Account for posts without the meta-key set: $pairedThing … Read more

list/consult Taxonomy only for the respective author/creator in dashbboard

The WP_Term_Query class doesn’t have a method named set, and calling $query->set() in my case resulted in a fatal/critical error saying “Call to undefined method WP_Term_Query::set()“. :/ But you can directly modify the query_vars property (i.e. $query->query_vars), like so, to set, unset or override any query variables like meta_query: // Use this: $query->query_vars[‘meta_query’] = $meta_query; … Read more

Advanced custom fields sort repeater by date

I think this is not possible with the API functions provided by ACF. I would try to save the values to a temporary array first and then sort the values inside the array with php (using krsort() for example). Something like this (just to give an idea): while(has_sub_field(‘in_the_news’)) { $date = get_sub_field(‘published_date’); // $date = … Read more

Get post by ASC from custome field DATE picker

So what you need to do is order it by the custom value of the meta_key date value. Something like this (untested): $wp_query = new WP_Query( array( ‘post_type’ => ‘upcoming_events’, ‘order’ => ‘ASC’, ‘meta_query’ => array ( array ( ‘key’ => ‘your_custom_date_key’, ‘value’ => date(‘Y-m-d’) ) ), ‘orderby’ => ‘meta_value’ ) ); Hope that helps.

Advanced custom fields: Customise date picker’s start date (need to choose year 1500 onwards) [closed]

You can do this by customizing the plugin. You’ll want to find timepicker.js in /wp-content/plugins/acf-field-date-time-picker/js/timepicker.js And change line 21: , yearRange: “-100:+100” to your preferred range, for example: , yearRange: “-500:+100” This gives you a dropdown that, by default, goes back 500 years and forth 100, from the current year. Or you can hardcode a … Read more

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