• Resolved TheLamb

    (@thelamb)


    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.

    https://www.ads-software.com/plugins/bbpress-simple-advert-units/

Viewing 4 replies - 1 through 4 (of 4 total)
  • I would also like to do this. But the plugin processes neither shortcodes nor PHP.

    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.

    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

    (@jezza101)

    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://www.ads-software.com/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.