Frustration with Posts Page

The WordPress Twenty Seventeen theme does not show recent posts on the Posts menu click. So…

I made a custom Posts menu link with a custom .php file. See code below:

<?php
/**
 * Loads the WordPress environment and template.
 *
 * @package WordPress
 */

if ( ! isset( $wp_did_header ) ) {

	$wp_did_header = true;

	// Load the WordPress library.
	require_once __DIR__ . '/wp-load.php';
}
// Get the most recent post date
$date = new DateTime( get_lastpostdate( 'server', 'post') );
// Redirect to the page using format of the most recent post date
header( "Location: " . get_site_url()  . "/" . $date->format( "Y" ) . "/" . $date->format( "m" ) . "/" );

die;
?>

Leave a Reply