How do I remove the_content and is_single advertisement from bbpress?
-
I have this function to display advertisement after first paragprah in posts:
add_filter( 'the_content', 'post_ads_1_paragraph' ); function post_ads_1_paragraph( $content ) { $ad_code = '<div class="advert" style="display: none;">Reklama1</div>'; if ( is_single() && ! is_admin() ) { return prefix_insert_after_1nd_paragraph( $ad_code, 1, $content ); } return $content; } function prefix_insert_after_1nd_paragraph( $insertion, $paragraph_id, $content ) { $closing_p = '</p>'; $paragraphs = explode( $closing_p, $content ); foreach ($paragraphs as $index => $paragraph) { if ( trim( $paragraph ) ) { $paragraphs[$index] .= $closing_p; } if ( $paragraph_id == $index + 1 ) { $paragraphs[$index] .= $insertion; } } return implode( '', $paragraphs ); }
The problem is that this function is somehow hooked to bbpress forum listing (forum description) to, and shows after forum description.
So how can I remove it from bbpress so it affects only posts?See word “reklama1” after each forum description: https://mllapan.com/forumi/forum/magazin/
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.