wp --info
wp theme update --all
Navigate to wp-content/plugins/
. Then run this command to create a new plugin called my-awesome-plugin
.
wp scaffold plugin my-awesome-plugin
wp plugin update --all
Check this example code.
/**
* List of views served by this composer.
*
* @var array
* @return array
*/
class My_Shortcode{
public function __construct(){
$this->register_shortcode();
}
public function register_shortcode(){
add_shortcode('shortcode_tag', [$this, 'get_shortcode_output']);
}
public function get_shortcode_output($atts){
return "Hello world"
}
}
// Initalize the class.
new My_Shortcode();