Title: Callback Function Broken
Last modified: August 21, 2016

---

# Callback Function Broken

 *  [Chris](https://wordpress.org/support/users/web2guru/)
 * (@web2guru)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/callback-function-broken/)
 * I created a callback function with the exact code that is in the default output
   function. When I add a shortcode to a post and specify the callback function,
   the page breaks on the shortcode (just the site header is shown, no content, 
   no footer). What could be the problem?
 * The end goal is I want to use shortcodes within the ads. I understand the plugin
   does not run shortcodes in the content, but shouldn’t I be able to run the do_shortcodes
   function on the $html variable just before it is returned (using the callback
   function)?
 * [http://wordpress.org/extend/plugins/ads-by-datafeedrcom/](http://wordpress.org/extend/plugins/ads-by-datafeedrcom/)

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

 *  Plugin Author [datafeedr](https://wordpress.org/support/users/datafeedrcom/)
 * (@datafeedrcom)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/callback-function-broken/#post-3901479)
 * Hi,
 * Can you post your code?
 * Eric
 *  Thread Starter [Chris](https://wordpress.org/support/users/web2guru/)
 * (@web2guru)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/callback-function-broken/#post-3901483)
 * Actually I figured part of it out. You can not use the default code because it
   uses the $this variable which is only available within the class.
 * I know there is a way to refer to the class, but I do not see where the class
   is instantiated. How do I refer to $this?
 * It is the exact same code as is found within the output function.
 *  Plugin Author [datafeedr](https://wordpress.org/support/users/datafeedrcom/)
 * (@datafeedrcom)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/callback-function-broken/#post-3901484)
 * You can’t use $this in your own custom callback function.
 * There are 2 arrays available to you: $ads and $args.
 * $ads contains all of the ads which appear in the result set.
 * $args contains all of the variables related to the result set.
 * However you can replace lines like this:
    `$this->open_tag(`
 * With lines like these in your custom function:
    `DFADS::open_tag(`

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

The topic ‘Callback Function Broken’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ads-by-datafeedrcom.svg)
 * [Ads by datafeedr.com](https://wordpress.org/plugins/ads-by-datafeedrcom/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ads-by-datafeedrcom/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ads-by-datafeedrcom/)
 * [Active Topics](https://wordpress.org/support/plugin/ads-by-datafeedrcom/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ads-by-datafeedrcom/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ads-by-datafeedrcom/reviews/)

## Tags

 * [ads](https://wordpress.org/support/topic-tag/ads/)
 * [callback](https://wordpress.org/support/topic-tag/callback/)
 * [datafeedr](https://wordpress.org/support/topic-tag/datafeedr/)

 * 3 replies
 * 2 participants
 * Last reply from: [datafeedr](https://wordpress.org/support/users/datafeedrcom/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/callback-function-broken/#post-3901484)
 * Status: not resolved