Custom query to retrieve oldest post and retrieve others with date interval

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

Query for getting posts with their custom fields data in WordPress

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

Is there documentation for objects returned by WP_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