ShortCode Help! How do I make my own shortcode

[ad_1]

Hello Guys,

I have products on my wordpress site that uses a common product description and Instead of write product description for each product can I just make my own Shortcode to add in PD section.

This way if my PD changes, I can just change it in one places and shortcode will automatically update in all the products. I don’t have programming knowledge.

Please help.

[ad_2]
1 Comment
  1. First of all, way to go using that noodle! You’re thinking like a developer.

    Here’s a template for a basic shortcode, courtesy of WPBeginner.

    // function that runs when shortcode is called
    function wpb_demo_shortcode() {

    // Things that you want to do.
    $message = ‘Hello world!’;

    // Output needs to be return
    return $message;
    }

    // register shortcode
    add_shortcode(‘greeting’, ‘wpb_demo_shortcode’);

    You would stick this in your functions.php, or the Code Snippets plugin. This example creates a shortcode [greeting] that always outputs “Hello world!” You should be able to modify it as need be.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer