Blank ads in Buddypress members activity page
-
I am using BuddyX theme and it’s not a problem displaying ads with ads inserter on Buddypress site’s activity stream but it’s not displaying ads when visiting a profile’s activity stream. It displays blank spaces.
This is caused because I have added the required code:
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9186173950485421" crossorigin="anonymous"></script>
in the html header code page section.
When adding this javascript code directly above the adsense code in the Ads Inserter block it works but in the future I want to disable ads for paid users so for this reason I prefer the javascript code above needs to be put in the header.
I am inserting the shortcode with the following code:
function buddydev_inject_content_after_n_activities() { static $current_activity_index = 1; // change $n to the correct number of activities. $n = 3; // After how many activities you want to inject content. if ( $current_activity_index % $n === 0 ) { echo do_shortcode('[adinserter block="4"]'); ?> <?php // show the activity injected content. } // increment the current index. $current_activity_index ++; } add_action( 'bp_after_activity_entry', 'buddydev_inject_content_after_n_activities' );
Please advice.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Blank ads in Buddypress members activity page’ is closed to new replies.