Add element to River (Elgg 2.x)

I want to show ads between the river items. Example: In the river page, it will show 5 item, then it will show an ad and then the renaming 5 river item.

Which file should I refer to for the source code that is used to create these river elements?

  • I found the file

    "views/default/page/components/list.php"

    I just added the following code in the end of the foreach loop and its done

    // Render Ads
    if(($index % 7 == 0) && ($item instanceof \ElggRiverItem) && (!elgg_is_admin_logged_in())){
         $ad_view = elgg_view("ads/google_ad_in_feed");
         $li_attrs['id'] = "item-river";
         $list_items .= elgg_format_element('li', $li_attrs, $ad_view);
    }