Here's a quick WordPress plugin for you, which should be pretty much 'set-and-forget'.
Installation instructions:
- Copy the content below into a new file called
days-since-last-post.php
, and place that file directly in your wp-content/plugins
folder.
- Go to the Plugins page in your WordPress admin, look for 'Days Since Last Post' in the list, and click Activate
This has been tested on WordPress 4.5.3, which is the latest version available as of this answer.
<?php
/*
Plugin Name: Days Since Last Post
Plugin URI: https://softwarerecs.stackexchange.com/questions/32079/
Description: Displays on the Dashboard the number of days since your last post
Version: 1.0.0
Author: Tim Malone, majick, David Kryzaniak
Author URI: https://softwarerecs.stackexchange.com/questions/32079/
License: GPLv2 or later
*/
add_action( 'wp_dashboard_setup', 'srse32079_add_dashboard_widgets' );
function srse32079_add_dashboard_widgets() {
wp_add_dashboard_widget( 'srse32079_lastpost', 'Days Since Last Post', 'srse32079_days_since_last_post' );
}
function srse32079_days_since_last_post() {
$recent = wp_get_recent_posts( array( 'numberposts' => 1, 'author' => get_current_user_id() ) );
$start = strtotime( $recent[0]['post_date_gmt'] );
$link = get_the_permalink( $recent[0]["ID"] );
echo 'There have been <strong>';
echo ceil( abs( time() - $start ) / 86400 );
echo ' days</strong> since your <a href="' . $link . '">last post</a>.';
}
Some code sourced from posts by majick and David Kryzaniak.
Changes/enhancements to this plugin are welcome via editing this post. Please include an edit summary, increment the version number, and add your name to the Author list. Most importantly, test your changes on the latest version of WordPress.