Can someone please give me a hello world example for placing text in a wordpress content page through a custom php plugin?
I have been doing it through creating pages with a div id (through wp-admin) and loading content through extensive amounts AJAX/Javascript into that same id. I want to learn how to do this server side. ( It would make my life soooo much easier )
Leave a Reply
You must be logged in to post a comment.
Use the Exec-PHP plug-in: http://wordpress.org/extend/plugins/exec-php/
Are you sure you want to use a plugin? Placing shorcodes in the
functions.php
file is the easiest route.Example
In your
functions.php
fileIn your blog post
The above would output. If your output is static, this would be the best way to go.
If you’re sure you want to make it into a plugin, you can do that too. Simply putting this code in a file and putting it into your plugins directory will work. Make sure that you use the proper standards when defining the plugins (see link below).
The last link has both mentioned in the blog post and has a nice plugin that you can use for your own needs. That blog post explains how you can use the shortcodes in widgets as well.
Links
http://www.smashingmagazine.com/2009/02/02/mastering-wordpress-shortcodes/
http://codex.wordpress.org/Shortcode_API
http://codex.wordpress.org/Writing_a_Plugin
http://aaron.jorb.in/blog/2010/02/wordpress-shortcodes-a-how-to-by-example/