The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] Making a hook in functions.php (2 posts)

  1. godavid33
    Posted 2 years ago #


    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)?

    Any help would be greatly appreciated,


  2. godavid33
    Posted 2 years ago #

    I solved the problem.

    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.

    Hope this helps someone - Cheers!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Wp-Insert
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic