You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With WDS-Shortcodes, each shortcode is comprised of two files; one for the front-end, and one to handle the admin stuffs. What you name them is totally up to you, but we like to keep it logical, so we tend to use {shortcode}-shortcode.php and for the admin - {shortcode}-shortcode-admin.php
If you're using the plugin generator, you'll need to prefix your file with class- and drop hem into your includes/ folder of the plugin.
Now, setting up the files takes a bit and warrants their own respective pages on the wiki, so here ya go:
Once you've set those two files up ( per-shortcode ) you'll want to include them in your setup and initialize the classes individually, below is an example:
/** * Attach other plugin classes to the base plugin class. * * @since 0.1.0 * @return void */publicfunctioninitalize_shortcode_button() {
// Attach other plugin classes to the base plugin class.// $this->plugin_class = new WDSCPN_Plugin_Class( $this );$this->test_shortcode = newWDSCPN_Test_Shortcode();
$this->test_shortcode_admin = newWDSCPN_Test_Shortcode_Admin(
$this->test_shortcode->shortcode,
self::VERSION,
$this->test_shortcode->atts_defaults
);
}
NOTE: If you are using the plugin generator you'll want to initialize these in the hooks() method, not in the plugin_classes() method.
The Hooks
Each parent class has a hooks method, without firing these, the plugin simply won't work. To do this, you will need to fire them, example below: