Hooks in discussions/comments list
I’m trying to add ads banner every after 4 discussion in discussion list. I managed to get it to work by cloning/editing the discussions.php to my custom theme. Added the ff on discussions.php:
- Looped through each discussion
- Added counter variable that increments every loop
- Set condition if counter === 4, display ads banner html & reset counter
This is working ok, however I think a better way of doing it is through plugin, so that I can add inputs for banner html, banner frequency & banner limit per page.
I tried using the base_betweenDiscussion_handler however it did not give me the expected results, since $sender->Discussions->result() is looping inside each discussion instead of looping through discussions list.
Need advice if this is possible through plugins or do I just leave it on my custom theme.