I am attempting to create a cron job for WordPress that will create a mailchimp campaign and send it out - it is to include wp-insert ads using the php function provided. That is somewhat beside the point. I have set up the hook and cron job correctly; the text part is all peachy but the php wp-insert function returns an empty div container. My suspicion is that the shortcode that the function uses is not yet defined in functions.php. Where can I define this hook so that it will successfully call wp_template_ad() and return the ad code but also be utilized by cron jobs?

Essentially I think I can solve the problem if these questions are answered:

- Where/when is the shortcode used in wp_template_ad defined?
- Where can I define hooks for them to be accessible to wp-cron jobs (I am using the plugin crontrol)?

The function wp_template_ad echos the result. I was trying to store it in a variable and append it to the html. I needed to return it rather than echo it, and this fixed the problem in case anybody else decides to try something similar.