-
Henry Wright replied to the topic Add ad code into activity stream in the forum Creating & Extending 10 years, 7 months ago
@bhekzin actually, instead of adding the ad as an activity item, you could just modify the activity loop to insert the ad dynamically on every 8th item. This is how you’d do that using a
for
loop:for ( $i = 1; $i < 1000; $i++ ) {
if ( $i % 8 == 0 ) {
// this is the 8th item so insert your ad code
}
} -
Henry Wright replied to the topic Add ad code into activity stream in the forum Creating & Extending 10 years, 7 months ago
@bhekzin you’ll need to decide if you’re going to add an ad after X number of items have been added to the stream or if you’re going to add an ad every X number of seconds (or minutes, or hours). If you choose the interval approach, check out
wp_schedule_event
https://codex.wordpress.org/Function_Reference/wp_schedule_event
@bhekzin
Active 10 years, 7 months ago