What is a WordPress Shortcode?

A shortcode is a special tag which allows you  enter into a post that gets

replaced with different content when actually viewing the post on the website

How do I Create A Shortcode?

Shortcodes are very easy to create. If you know how to write a basic

PHP knowledge on function's

For our first one, let’s create the well-known “Hello, World” message.

1.Open the functions.php file from your selected theme folder.

If the file doesn’t exists, create it.

Now we will create an function to return "Hello world"

we have a function, we have to turn it into a shortcode. to Create an shortcode we will use add_shortcode() function

The first parameter is the shortcode name, and the second is the function to be called. Now we have created the shortcode , we can use it in blog posts and on pages. To use it, simply switch the editor to HTML mode and type the following:

You’re done

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

%d bloggers like this: