• Participant
    Level: Initiated
    Posts: 2
    Daniel on #34869

    Unfortunately im not comfortable in JS. Not really a coder tbh.
    If theres a way around writing code it would be appreciated.

    Otherwise I appreciate the quick response!


  • Participant
    Level: Initiated
    Posts: 2
    Daniel on #34857

    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 …

    // show the activity injected content.
    // increment the current index.
    $current_activity_index ++;


    add_action( ‘bp_after_activity_entry’, ‘buddydev_inject_content_after_n_activities’ );’