Title: use shortcode instead of ad code
Last modified: August 21, 2016

---

# use shortcode instead of ad code

 *  Resolved [TheLamb](https://wordpress.org/support/users/thelamb/)
 * (@thelamb)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/use-shortcode-instead-of-ad-code/)
 * I was wondering if it’s possible to use a shortcode to generate the adverts as
   my site uses a responsive theme and I’ve installed GARD to output ads based on
   the size of the screen, this works perfectly on all pages but doesn’t work with
   this plugin for my forums.
 * Is there anyway to get this working or can this be added in a future update?
 * Alternatively is there any other way for this plugin to pick the ads based on
   the screen size? I’ve tried using the google beta of responsive adverts but they
   don’t work on my site either, I think because the beta uses asynchronous adverts
   and my theme doesn’t support them.
 * Thanks.
 * [http://wordpress.org/plugins/bbpress-simple-advert-units/](http://wordpress.org/plugins/bbpress-simple-advert-units/)

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

 *  [Daniel J. Lewis](https://wordpress.org/support/users/djosephdesign/)
 * (@djosephdesign)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/use-shortcode-instead-of-ad-code/#post-4375442)
 * I would also like to do this. But the plugin processes neither shortcodes nor
   PHP.
 *  [Daniel J. Lewis](https://wordpress.org/support/users/djosephdesign/)
 * (@djosephdesign)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/use-shortcode-instead-of-ad-code/#post-4375443)
 * With lack of support or response from the developer, I’m forking this on GitHub
   and will let you know what it takes to fix.
 *  [Daniel J. Lewis](https://wordpress.org/support/users/djosephdesign/)
 * (@djosephdesign)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/use-shortcode-instead-of-ad-code/#post-4375444)
 * Got it! Make these changes to bbpress-simple-advert-units.php.
 * At about line 326, add `$content = do_shortcode( $content );` above `return $
   content;`.
 * At about line 456, add `$output = do_shortcode( $output );` above `return $output;`
 *  Plugin Author [jezza101](https://wordpress.org/support/users/jezza101/)
 * (@jezza101)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/use-shortcode-instead-of-ad-code/#post-4375445)
 * Thanks Daniel.
 * Parsing shortcodes seems the simplest way to handle this, and I want to keep 
   the plugin simple (hence the name!).
 * On my own sites I have used the following to detect mobile devices:
    [https://wordpress.org/plugins/wp-mobile-detect/](https://wordpress.org/plugins/wp-mobile-detect/)
 * With this installed, and shortcode parsing on, you can do:
    [phone]ad for phone
   users[/phone] [tablet]ad for phone users[/tablet] [notdevice]Every one else[/
   notdevice]
 * GARD seems interesting though, I might have a look to see if that it is useful
   to me too. One of my sites is aimed at mobile users so responsive design is always
   of interest.

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

The topic ‘use shortcode instead of ad code’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/bbpress-simple-advert-units_c7bee8.
   svg)
 * [bbpress Simple Advert Units](https://wordpress.org/plugins/bbpress-simple-advert-units/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/bbpress-simple-advert-units/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/bbpress-simple-advert-units/)
 * [Active Topics](https://wordpress.org/support/plugin/bbpress-simple-advert-units/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/bbpress-simple-advert-units/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/bbpress-simple-advert-units/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [jezza101](https://wordpress.org/support/users/jezza101/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/use-shortcode-instead-of-ad-code/#post-4375445)
 * Status: resolved