I Need Your Help In Creating This Plugin
-
I’ve started coding my first bbPress plugin and I’m now pretty familiar with most of the actions and filters and some of the inner workings of bbPress but I’m stuck.
The idea of my plugin is to insert AdSense code block in every topic at post X where X is either random or defined by the admin. I’ve been messing around with the post_text filter which allows me to change the text of any given post and insert an AdSense block. I can mess around with the author name and stuff too. The problem is that by doing this I replace the current post with the AdSense block instead of simply inserting it before or after the post, thus the post I replace isn’t visible.
To get around this I tried to first display the AdSense post then include the post.php file in the currently selected theme. But this crashes, I think due to an infinite loop. I then noticed the pre_post filter which looked promising but I couldn’t find where it’s defined or how it’s used.
In short, I need an alternative approach or solution to create a custom (and theme-independent) post.
My code, so far, is visible here: http://pastebin.com/m1cbf6b24
Cheers
- You must be logged in to reply to this topic.