How to Add Adsense Ads to bbPress Forum?


wordpress. In order to add Adsense Ads in the forum, the best places to add is before and after forum topics.

Add the following code to the child theme functions.php template.

function bbpress_header_code() {
  echo "Your Ads";
}

function bbpress_footer_code() {
  echo "Your Ads";
}

add_action( "bbp_template_before_forums_index", "bbpress_header_code" );
add_action( "bbp_template_after_forums_index", "bbpress_footer_code" );

add_action( "bbp_template_before_topics_loop", "bbpress_header_code" );
add_action( "bbp_template_after_topics_loop", "bbpress_footer_code" );

add_action( "bbp_template_before_single_topic", "bbpress_header_code" );
add_action( "bbp_template_after_single_topic", "bbpress_footer_code" );

Applying these code will put ads before/after the forum index, single topic page and the topics loop. The advantage of doing so is that it will not be affected if you change/upgrade the bbPress theme/plugin.

Google Adsense

Wordpress is King!

–EOF (The Ultimate Computing & Technology Blog) —

235 words
Last Post: How to Improve SEO by NoIndexing Attachment and Pagination in WordPress?
Next Post: Does Blocking Adsense Categories Help in Earnings?

The Permanent URL is: How to Add Adsense Ads to bbPress Forum? (AMP Version)

2 Comments

  1. Joachim
  2. infomiasto

Leave a Reply