If you want to display google Ads after first post on every topic, you can use ‘bbp_show_lead_topic’ function. The ‘bbp_show_lead_topic’ function is an alternate layout style where topics appear as ‘lead’ posts.
How to Use it
Locate the includes/topics/functions.php and write the following:
function custom_bbp_show_lead_topic( $show_lead ) { $show_lead[] = 'true'; return $show_lead; } add_filter('bbp_show_lead_topic', 'custom_bbp_show_lead_topic' );
Now the first post of every topic will be the ‘Lead Topic’ and ‘Lead Topic’ uses the single topic part content-single-topic-lead.php allowing you to style the lead topic separately from the main post loop.
Customize the single topic lead
Now you just need to edit the content-single-topic-lead.php file which is generally located on ‘/templates/default/bbpress/content-single-topic-lead.php’.
Open the file in editor and find the below lines:
..... ..... <?php do_action( 'bbp_theme_after_topic_content' ); ?> </div><!-- .bbp-topic-content --> .... .... ....
Add you ads script below the above lines :
..... ..... <?php do_action( 'bbp_theme_after_topic_content' ); ?> </div><!-- .bbp-topic-content --> <div class="customScriptCode"> // Put your html/script/custom code </div> ....
You have done!