How to get a plugin to display original content
-
I’m working on a plugin, and I’m having a tough time getting it to do something neatly.
For the sake of simplicity, let’s say all I want to do is the following: When navigating to https://www.mysite.com/wp/?test=1 it will display (using the “page” template) my own custom content.
So far, I have something like this:class test { function dopage () { include(get_page_template()); exit; } } if ($_GET['test']) { $_GET['p'] = -1; add_action('template_redirect', array('test', 'dopage')); }
But I’m having problems with that because 1) I can’t get my own content to appear in the appropriate place. 2) I still get the “Edit this entry” appearing on the page.
Say all I wanted was for “<h1>Hello World</h1>” to appear where normal page content would appear on that page (where the_content() is in the template), how would I do that?Sorry if this kind of thing has been asked before, I looked through the forums a bit but didn’t see anything helpful, and I really didn’t know what to search for. I’m not even particularly happy with my choice of topic title (rather vague) but I didn’t know how to be more descriptive of what I want. If someone could direct me to another forum post that goes over the same thing, or even just a plugin that does something like this already that I could pick apart and study I’d be really greatful.
Thanks a bunch.
- The topic ‘How to get a plugin to display original content’ is closed to new replies.