WordPress plugin question
Dec 23rd, 2008 by JoeC
If there are any WordPress plugin coders reading this, I need your help.
I’m writing a WordPress plugin to add Open Microblogging Support to a blog. In order to do this, I’d like the plugin to add a special OpenMicroblogging Page to the blog. This special Page is supported by a custom Page Template. Page Templates are normally added to the theme directory. And therein lies my lack of understanding. How do I get a plug-in to add a page template? Copy the php file in the installer code? Seems a little dodgy, but maybe?….
Do you actually need a page template? Would a [short code] or two work? It seems like the user might want the ability to put this on the page with other things but it depends on how much you are doing on the page.
Are we looking at a form for input and a list of recent posts or are you planning something much bigger?
Not an add-in for the sidebar or a like badge. It’s really a whole page, almost like another app, embedded into that page.
A page template contains a lot of things, including the page styles. Depending on what the page will contain, it might be more prudent to create a new template tag that people can insert into a page.
You might even be able to automate the construction of the page using the default page template for the theme but with your template tag in place.
@Hilary
I need a little more explanation on the second suggestion. I’ll email.
Joe,
Are you wanting to replace/modify the template’s default header, footer, or sidebar? If so which ones and to what degree?
If you are not changing the header or footer, you can ask the user to create a blank page (and as a bonus they can name it whatever they want) and insert your shortcode and save it.
For example the user would type [Open-Microblogging] as the only content of the new page then your plugin would replace the short code with a whole page of code. You can include tabs, forms, ajax, and… well… everything.
Again, the only limit here is that you are keeping the theme’s header and footer, because you can modify the sidebar separately.
References:
http://codex.wordpress.org/Shortcode_API
http://wordpress.org/extend/plugins/pageview/ (another way)
http://wordpress.org/extend/plugins/social-media-page/ (plugin using similar method)
http://wordpress.org/extend/plugins/blogroll-links-page/ (older shortcode method)
[...] http://joecascio.net/joecblog/2008/12/23/wordpress-plugin-question/ Joe asked about building a page template inside a [...]