Support » Plugins » days since first post

  • hi, i just want to add a count that counts the days since post, but this thing wont work:

    Plugin Name: Days Since Birth
    Plugin URI:
    Description: Outputs the total number of days since first blog post.
    Version: 1.0
    Author: Emma M.
    Author URI:
    */ </p>
    <p>function days_since_birth() {
    global $wpdb;
    $now = gmdate(”Y-m-d H:i:s”,time());
    $first_post = $wpdb->get_results(”SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = ‘publish’ AND post_date < '$now' ORDER BY post_date ASC Limit 1");
    if ($first_post) {
    foreach ($first_post as $post) { </p>
    <p> $first_day=strtotime($post->post_date_gmt);
    <p> //Then you subtract the lower date from the higher.
    $between = $now - $first_day;</p>
    <p> //Finally your divide the result by the number of seconds on a day.
    $days_old = $between / (24*3600); </p>
    <p> }
    } else {
    echo round($days_old);

    it’s from:

  • The topic ‘days since first post’ is closed to new replies.