bbPress Advertising Simpler Than Simple:Press

Make Money Online With AdSense Image

If you want to earn revenue from your forum, then bbPress advertising is simpler than Simple:Press.

Though I learned how to add AdSense to my old Simple:Press forum, it was always a struggle to get the code right. But, there is a bigger problem. Before I explain that, you need some background information.

I became very good at supporting Simple:Press, and I helped several people with advertising, and other problems. In it’s early days, author support for Simple:Press was good, but as it’s support forum became busier, the quality of help dropped. As the authors put efforts into adding more and more features to Simple:Press, they first lost the ability to support their WordPress plugin. Eventually, they withdrew support completely, except for people willing to pay.

Most Simple:Press users were not in a position to pay for support, so they were left to work their own way through plugin code that had become very complicated. What started as a great way to run a forum, became a nightmare for many webmasters who were just trying to provide support, often free. Personally, I lost thousands of visitors as my forum became hard to use. In that situation, advertising revenue was bound to fall.

Fortunately, I found bbPress, and it also led me to a very elegant solution for adding AdSense code to my forum. If you feel trapped by Simple:Press, bbPress has import routines that are easy to use and will soon transfer all old discussions. Unlike Simple:Press, bbPress truly is simple. It focuses on key features that all forums need, with an active group of third party developers who have provided a plethora of useful add-ons.

Not only does this make development quick and easy, but bbPress also uses a very simple database structure to handle forum posts. By using WordPress custom posts for forum data, the bbPress forum plugin is natively fast, and very easy to understand. I may talk about other benefits in subsequent posts, such as easy administration of RSS feeds and import routines. However, I’d like to return to advertising in general, and AdSense in particular.

AdSense is vital to many online businesses, and if you are incorporating it into forums, you need to be careful. There are specific rules regarding the placement of adverts near to images, and also restrictions on the number of adverts you may show on a page. You also need to decide if you want adverts near content or separate.

Separate adverts are easy to implement because you can add AdSense or other code to text widgets in the sidebar. Though this neatly separates content from advertising, it also runs the risk of taking adverts outside the natural line of sight. In my opinion, sidebars are good for navigation, but for advertising, you are much better following Google AdSense guidelines, and

Place your ads close to the content that your users are interested in.

AdSense Optimization Tips: Best practices for ad placement
Make Money Online With AdSense Image
Make Money Online With AdSense

You can see from the pages on this website, that my adverts are positioned at the beginning and end of my content. The adverts are displayed in a clearly identified space, within the content area, but not dominating it. I do this by a simple function that I will explain in a separate article. It was very easy to adapt my AdSense display function to work in my bbPress forum.
function insertforumads($content) {
global $adtextmid;
global $adcount;
if ($adcount == 0 && !$adtextmid) setglobaladtext();
if (intval($adcount/3) == $adcount/3) $content = $adtextmid.$content;
$adcount += 1;
if ($adcount > 6) $adtextmid = '';
return $content;
}
add_filter ('bbp_get_reply_content', 'insertforumads');

AdSense bbPress Forum Ads
AdSense Forum Ads
bbPress displays forums by first displaying the original topic post, followed by any replies in a pagination routine. You can control the number of replies per page in bbPress settings (Admin – Settings – Forums). I use 9 replies per page, so my routine inserts forum ads every 3 posts. Note that, though strictly the original post is a topic, not a reply, bbPress calls it through the bbp_get_reply_content hook. That hook will always return forum content irrespective of whether it is stored as a topic or a reply.

My routine starts with post 0 then repeats for posts numbered 3 and 6. This inserts forum ads before the content of the first, fourth, and seventh posts, as you can see from the screenshot on the right.

The code above includes my setglobaladtext() function which I will cover in a separate article. It sets a global variable, $adtextmid, to contain your AdSense code. Using a counter, $adcount, it initializes the advert code when $adcount is zero. You could change that to any positive integer to make your first advert appear further down the forum page. My routine then displays advert text if the count is a multiple of 3. You can change this value to adjust the spacing of adverts, but be sure to also change the upper limit, which clears the advert text. In my example, I clear the advert text when the counter goes above 6.

This is a simple function that uses the same code for each advert placement. If your forum traffic increases, you should consider setting individual codes for each placement that identify different channels for revenue reporting. That allows you to optimize revenue for each placement, but is not worth considering until basic revenue streams are significant.

For help using or improving the code for displaying adverts in your forum, please ask in the bbPress Advertising simpler than Simple:Press discussion, or elsewhere in Shrewdies Website Support Forum.