Best 2 Know

The Ultimate Blogging Resource

  • Advertising
  • WebHosting
  • Contact Us
  • Blogger
    • Blogger Templates
    • Blogger Tutorials
  • Browser
    • Firefox
    • Google Chrome
  • Google
  • Internet
    • Facebook
    • Twitter
  • Thesis
  • Windows
  • WordPress
    • WordPress Themes
    • WordPress Plugins
  • More
    • Linux
    • Review
    • Solutions
    • Announcements

How to create a Shortcode

WordPress shortcode are very useful function that helps lot of us. its similar to shortcuts , its been introduced since WordPress 2.5 They’re hooks which allow you to call a php function simply by typing something like [shortcode]. It is a great way to save time on repetitive tasks

To create a shortcode, you first have to create a php function and then you need to add it to your functions.php
We will be writing a basic function here :

function myfunction() {
    return 'I m learning now How to create a Shortcode in WordPress at <a href="http://wpden.net">WordPress Den</a>';
}

Once you are done with function, you need to use add_shortcode() function. Paste this code in your functions.php :

add_shortcode('wpden', 'myfunction');

as you can clearly see above wpden is my Shortcode for the function of myfunction

Now you can use the Shortcode were everyou want in your post or page (In HTML Editor):

[wpden]

The Above Shortcode will give the result :
I m learning now How to create a Shortcode in WordPress at WordPress Den

Subscribe via Email

Share this:

  • Twitter
  • Facebook
  • Pocket
  • Print
  • Email

Related

March 14, 2011 Ritesh Sanap WordPress Shortcode, Tricks, wordpress hacks, WordPress Tips, WordPress Tricks

Post navigation

Previous Previous post: Best 2 Know was Hacked
Next Next post: How to add our own logo to Dashboard

Currently Trending

  • Windows Vista CD key
  • How to download Specific parts of YouTube videos
  • How to Increase Dropbox upload speed
  • ZooZooo - Vodafone Logos
  • Highlight Author Comment in Blogspot
  • How To Change Windows XP Shutdown Dialog Box
  • How to Change the Welcome/Login Screen in Windows XP ?
  • HORIZONTAL AND VERTICAL SPACING
  • How to show hidden files and folders in Mac OS X
  • GTalk Tips and Tricks / Shortcuts

Random Posts

Creating custom couter strikes 1.6 sprays

January 16, 2008 By Ritesh Sanap Leave a Comment

Change From .co.in to .com in orkut – Enjoy Better orkuting

July 16, 2008 By Ritesh Sanap Leave a Comment

Record a Screencast

March 28, 2009 By Ritesh Sanap 1 Comment

4 Games You Can Play while Working

August 1, 2011 By Ritesh Sanap 11 Comments

The Incredible Hulk 2008

July 12, 2008 By Ritesh Sanap Leave a Comment

WordPress

HTTP2 Server Push for W3 Total Cache Minify plugin

August 17, 2016 By Ritesh Sanap 5 Comments

How to Disable Emojis in WordPress

January 6, 2016 By Ritesh Sanap Leave a Comment

JetPack Related posts and Sharing not working with NGINX

November 10, 2015 By Ritesh Sanap Leave a Comment

Simply Pure – WordPress Theme

November 2, 2014 By Ritesh Sanap 2 Comments

Advanced What should we Write about next? – WordPress Plugin

July 28, 2014 By Ritesh Sanap Leave a Comment

How to Disable Self Pingback or TrackBack

January 16, 2014 By Ritesh Sanap Leave a Comment

BlueStrap – WordPress Theme

January 1, 2014 By Ritesh Sanap 15 Comments

How to Create Multiple Excerpts in WordPress

December 24, 2013 By Ritesh Sanap Leave a Comment

How to Disable Auto Update in WordPress

November 21, 2013 By Ritesh Sanap Leave a Comment

How to Delete Feedbacks from JetPack Contact Form

November 19, 2013 By Ritesh Sanap 9 Comments

Recent Posts

  • HTTP2 Server Push for W3 Total Cache Minify plugin
  • How to show hidden files and folders in Mac OS X
  • How to Disable Emojis in WordPress
  • Canva – Online Photo Editor
  • JetPack Related posts and Sharing not working with NGINX

Archives

Recommends

  • DigitalOcean – Cloud Hosting
  • Dropbox – Cloud Storage
  • Elegant Themes – WordPress Themes
  • LastPass – Password Manager
  • Like us on Facebook
  • Follow on Twitter
  • +1 on Google
  • Subscribe via Email
  • RSS Feed

© 2021 Best 2 Know · All Rights Reserved · We ♥ DigitalOcean

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.