Title: Looking for specific functionality
Last modified: December 27, 2016

---

# Looking for specific functionality

 *  [cohenner](https://wordpress.org/support/users/cohenner/)
 * (@cohenner)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/looking-for-specific-functionality-2/)
 * I need to create a daily email that shows a link to all of the posts posted that
   morning.
 * For instance, the client posts 5 new posts every day. I need to have an email
   that shows a link to all 5. This email should be sent shortly after all 5 are
   posted.
 * I am running a plugin which will post only one link to one post. It is working
   properly, and emails are going out and the cron fires, but does not fulfill my
   needs, as it only shows one link.
 * Thoughts?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/looking-for-specific-functionality-2/#post-8594793)
 * It may or may not be feasible to hack the plugin so it returns all posts published
   in the previous day. Creating your own plugin that does this isn’t too complex
   if you can manage some PHP coding.
 * You’d write a function that queries for all posts published in a certain period
   such as the last 24 hours. You can use [WP_Query class](https://codex.wordpress.org/Class_Reference/WP_Query)
   for this. Your code then loops through the results much like any other WP loop,
   except the HTML is compiled into an email message instead of being output. Unless
   all of your content is plain text, use the “[wp_mail_content_type](https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_mail_content_type)”
   filter to set the email mime type to text/html.
 * You then schedule your function to be called on a daily basis with [wp_schedule_event()](https://codex.wordpress.org/Function_Reference/wp_schedule_event).
   Note that your function will not be called exactly on a 24 hour interval, so 
   if you query for posts in the last 24 hours exactly, there’s a small chance a
   post or two could be missed. OTOH, if you query for posts in the last, say 25
   hours, to compensate, there’s the chance you’ll get some redundant posts from
   email to email.
 * You could store the timestamp of the current query as a transient, then use it
   to compose the next query’s date range. Then the results will always be correct,
   at the price of a little extra coding.
 * Unless you’re familiar with coding WP modifications, this probably sounds hopelessly
   complex. If you focus on one specific, small task at a time, in the end you’ll
   find it’s all not nearly as bad as it sounds right now.
 *  [Robert D Payne](https://wordpress.org/support/users/rpayne7264/)
 * (@rpayne7264)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/looking-for-specific-functionality-2/#post-8630520)
 * Have you seen this: [Email posts to subscribers](https://wordpress.org/plugins/email-posts-to-subscribers/)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Looking for specific functionality’ is closed to new replies.

## Tags

 * [cron](https://wordpress.org/support/topic-tag/cron/)
 * [daily](https://wordpress.org/support/topic-tag/daily/)
 * [email](https://wordpress.org/support/topic-tag/email/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 3 participants
 * Last reply from: [Robert D Payne](https://wordpress.org/support/users/rpayne7264/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/looking-for-specific-functionality-2/#post-8630520)
 * Status: not a support question

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
