Variable in shortcode | WordPress.org

[ad_1]

Hi,

I wonder if it is possible to add a variable in the call to an HTML shortcode and then evaluate it in php code

By example calling the shortcode in the page like this [code_snippet id=25 php format color=”blue”] or [code_snippet id=25 php format color=”red”]

And then evaluate it in the code link this

if ($color == ‘blue’){

do something…

}

 

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