Your problem is that you are using the wrong hook to add your shortcode. wp_enqueue_scripts
is executed way too late and should only be used to add javascript includes.
You should instead consider using the hook called init
for adding your shortcodes. This hook is called after the current theme’s functions.php
has been included which means that you don’t risk getting your shortcode overridden (unless that is a desired feature) by the theme if there is a name collision.
Here is a list of available actions: Plugin API – Action Reference.
If you’re going with the init
hook for the shortcodes but still want the plugin to be hooked to plugins_loaded
you could do something like these changes:
class SimplistSlider {
public function __construct() {
// Hook shortcodes
add_action('init', array($this, 'registerShortcodes'));
// Hook javascripts
add_action('wp_enqueue_scripts', array($this, 'registerScripts'));
}
// ...
public function registerShortcodes() {
// adding shortcodes here
add_shortcode('slider', array($this, 'shortcode'));
}
// ...
}