List Most Read Posts from last 7 days (with custom post type and other meta queries)
List Most Read Posts from last 7 days (with custom post type and other meta queries)
List Most Read Posts from last 7 days (with custom post type and other meta queries)
WP_Query with UNIX timestamp in meta query
First, do not query_posts; use WP Query instead. That being said, I assume that pce_monday_open is lower than pce_monday_close and that you want posts between pce_monday_open and pce_monday_close, so I think your comparison logic is wrong. Also, you may need to set the relationship between the two meta query arrays: $pce_arg = array( ‘cat’ => … Read more
I formed this query based on this answer. I would appear this is no longer the way to do it… I reformatted the query to look like this: query_posts( array( ‘post_type’ => ‘events’, ‘showposts’ => -1, ‘order’ => ‘ASC’, ‘orderby’ => ‘meta_value_num’, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘_ecmb_datetime’, ‘value’ => strtotime(‘today … Read more
I figured it out. For anyone who needs to find this solution I edited the above code. I changed: ‘order’ => ‘DESC’ to ‘order’ => ‘ASC’ , and ‘orderby’ => ‘meta_value_num’ to ‘orderby’ => ‘meta_value’ to achieve the order I wanted.
Since the roles for a user are stored in (dbprefix)_capabilities, I’d try grabbing the database prefix and then using it to grab people with the right capabilities (caps are in a serialized array): global $wpdb; $prefix = $wpdb->prefix; $meta_name = “{$prefix}capabilities”; ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => “{$meta_name}” ‘value’ => ‘program_manager’, ‘compare’ … Read more
Meta query not returning results even though the sql contains the information
WP_Query with meta_value_num and meta_query not paged correctly
You can use this format of meta_query, although you’d have to change the format of all of your existing expiry-date entries. ‘meta_query’ => array( ‘key’ => ‘expiry-date’, ‘value’ => array($today, $UserInputExpiry), ‘compare’ => ‘BETWEEN’, ‘type’ => ‘DATE’ ) The second date in the array is the later date and both $today and $UserInputExpiry should be … Read more
Get closest event where meta_key field is an array