[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]
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.