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

Posts per Page on custom Taxonomy Template

number_posts is not a valid parameter in pre_get_posts, you should be using posts_per_page You should also include a check (!is_admin()) in your query to check whether you are on the front end or back end as pre_get_posts alters back end queries as well Rewrite your code to the following: add_action( ‘pre_get_posts’, function ( $query ) … Read more

Get latest posts from multisite

There is actually a way to get posts from all multisite sub-sites. I do it with my “Multisite Media Display” plugin here https://wordpress.org/plugins/multisite-media-display/ . I use it to display all media items from my multisite to ensure that any submissions meet the site requirements. Works great. I have a similar plugin for posts, but it … Read more