Comparing Meta Field date in WPQuery using Meta_Query?
ACF stores it’s dates in Ymd format, this is why i couldn’t compare. Make sure your date is in Ymd format when you compare it against an ACF datefield.
ACF stores it’s dates in Ymd format, this is why i couldn’t compare. Make sure your date is in Ymd format when you compare it against an ACF datefield.
WP_Query not returning any posts
I’ve quickly tested the below code with a small subset of sendouts ( 3 ) and changing the publishing date of my page that uses this template it works fine <?php /** * Template Name: show sendouts template * */ get_header(); global $wpdb, $post; $curDate=strtotime(date(‘Y-m-d H:i:s’)); $postDate=strtotime($post->post_date); $pageAge=($curDate-$postDate) / (60 * 60 * 24); // … Read more
You can use this code, $args = array( ‘cat’ => 4, // Category ID // ‘category_name’ => ‘staff’, // Category Name ‘posts_per_page’ => -1, ) // The Query $query = new WP_Query( $args ); // The Loop while ( $query->have_posts() ) { $query->the_post(); $thumbnail_image = get_post_meta( get_the_ID(), ‘thumbnail_image’, true ); $first_image = get_post_meta( get_the_ID(), ‘first_image’, … Read more
This is the way you could handle it, though opinions may vary. Getting the framework up will be a bit complicated and making it pretty is another task entirely. I would make it sexy by running an AJAX query when you submit the form. The AJAX script collects all the data from the boxes on … Read more
Just go by the modified date. WP sets both the published date and the modified date to the same time, when you publish a new post. So, the modified date will always have the most-recent date for every post – whether it’s brand-new or an update.
I solved it like this array: <?php $args = array( ‘post_type’ => ‘post’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘showposts’ => ‘3’, ‘cat’ => ‘-1,-2,-3’, );
So I realized there’s no open API for WooCommerce that can handle this, and my research declared that there were nobody else doing this. At least not to my knowledge. So I created the code, and it works. I’ll share my code in case anybody else would like to use WordPress as a headless CMS … Read more
Check for not NULL not working in meta query
The tag objects returned by get_the_tags() use WP_term class. You can see this by inspecting the function’s source. The class is mentioned on the last line of the comment. function get_the_tags( $id = 0 ) { /** * Filters the array of tags for the given post. * * @since 2.3.0 * * @see get_the_terms() … Read more