Replies
This is the current code that makes content appear infinite times every n posts. How would i change this to make the content only come up once at a specified number of posts?? thanks
‘/**
* Inject content into BuddyPress Activity stream after ‘n’ activities.
*/
function buddydev_inject_content_after_n_activities() {
static $current_activity_index = 1;// change $n to the correct number of activities.
$n = 5; // After how many activities you want to inject content.if ( $current_activity_index % $n === 0 ) {
?>
<li class=’activity-item activity-ad-item activity-custom-entry’>
Your code snippet …<?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’ );’