Posts Tagged ‘ WordPress Shortcodes ’
Creating a Simple Shortcode
Friday, February 12th, 2010WordPress shortcodes are actually very easy to create. If you know how to write a basic PHP function, then you already know how to create a WordPress shortcode. For our first shortcode, let’s create the well-known “Hello, World” message.
- Open the functions.php file in your theme. If it doesn’t exist, create one.
- First, we have to create a function to return the “Hello World” string. Paste this in your functions.php file:
function hello() {
return 'Hello, World!';
} - Now that we have a function, we have to turn it into
…