WordPress.org

Forums

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

  1. godavid33
    Member
    Posted 1 year ago #

    Hi,

    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,
    Gabe

    http://wordpress.org/plugins/wp-insert/

  2. godavid33
    Member
    Posted 1 year 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!
    Gabe

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic