Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Create And Use Shortcode in Wordpress

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 280
    Comment on it

    Shortcode is a special feature of wordpress .  In other words we can call it a simple set of functions  Developer can  create the functionality specific shortcode and can use it either at admin end in page or post  or in any code file.

    The following short code is used to display a simple message .

    How to create and use Shortcode:
    1) Create Shortcode in functions.php file

    function get_message() {
      return "Welcome User, This is the proper way how to declare and use a shortcode";
    add_shortcode('call_shortcode', 'get_message');

    2) Now add the following code where you want to display the message.


       A) For adding "Admin" post or page.    


      B) Using short code in any file of project.


    echo do_shortcode('[call_shortcode]');

    We can also pass parameters while calling shortcode

    [call_shortcode name="test"]
    function get_message($atts, $content = null) {
       extract( shortcode_atts( array(    
        'name'  => ''
        ), $atts ) );
      return "Welcome ".$name;




 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: