# Shortcodes Service

The shortcodes service is actually extremely similar [to the hooks service](https://framework.deep-web-solutions.com/utilities-module/hooks-service) described previously. It's a [single-handler service](https://framework.deep-web-solutions.com/foundations-module/utilities/handlers-and-services) with [a runnable and a resettable action](https://framework.deep-web-solutions.com/foundations-module/actions). It provides the following public methods:

* `add_shortcode` - registers a shortcode with the handler
* `remove_shortcode` - removes a shortcode registered with the handler
* `remove_all_shortcodes` - removes all shortcodes registered with the handler

It accepts any handler implementing the [`ShortcodesHandlerInterface`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Shortcodes/ShortcodesHandlerInterface.php) and, just like the hooks service, comes with a default handler that first stores all registered shortcodes in an array and registers them with WP on the `run` action.

The similarities don't end there though! All the traits and interfaces mentioned for the hooks service are also available for the shortcodes service:

* [`ShortcodesServiceAwareInterface`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Shortcodes/ShortcodesServiceAwareInterface.php) and [`ShortcodesServiceAwareTrait`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Shortcodes/ShortcodesServiceAwareTrait.php) for a getter/setter pair
* [`ShortcodesServiceRegisterInterface`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Shortcodes/ShortcodesServiceRegisterInterface.php) and [`ShortcodesServiceRegisterTrait`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Shortcodes/ShortcodesServiceRegisterTrait.php) for injecting the service externally
* [`InitializeShortcodesTrait`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Actions/Initializable/InitializeShortcodesServiceTrait.php) for automagically setting the instance on the objec
* [`SetupShortcodesTrait`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Actions/Setupable/SetupShortcodesTrait.php) for automagically calling the `register_shortcodes` method on setup
