WordPress.org

Ready to get started?Download WordPress

Forums

Cron job to call php to email last 24 hours posts (1 post)

  1. cheltenhammedia
    Member
    Posted 11 months ago #

    We have been trying to call via CronJob a php script that will email the past 24 hours posts using the 'post_type' = 'reservations' filter.

    Below we have been using some script from a previous forum post but just cannot get it to work, the emails are coming through blank.

    <?php 
    
        function filter_where($where = ”) {
        $where .= ” AND post_date > ‘” . date(‘Y-m-d’, strtotime(‘-1 days’)) . “‘”;
       return $where;
    }
    add_filter(‘posts_where’, ‘filter_where’);
    $args = array(
       ‘paged’–> $paged,
       ‘post_type’ => ‘reservations′
    );
    query_posts($args);
    ?>

    Any php gurus out there that could shed some light on this, or is there an easier way?

Reply

You must log in to post.

About this Topic

  • RSS feed for this topic
  • Started 11 months ago by cheltenhammedia
  • This topic is not resolved
  • WordPress version: 3.5.2