Loading...

How to make you own shortcode!

How to make you own shortcode!

Faisal / Wordpress

Let’s learn the magic of shortcode . These are magical piece of very user friendly text that will generate a complex code at the backend , which enables to make something happen on the front end.

example: [abc] 

Yes! that’s a shortcode! Now how to make it work?

Just look at below simple code:

See now if you add the above lines of shortcode into your functions.php file, then a shortcode as [abc] will be added to your wordpress database.

To use it simply put it in any page or post as [abc] and publish, it will generate ‘hello world!’ . see how simple it is?

Now this way you can make bring it into many uses. This is a very basic example just to get you started  , shortcodes have much more features , bring it with use of attributes .

example: [abc title=”hello” link=”google.com”]

Now try this out and see what happens !

Leave a Comment