Last active
May 9, 2019 13:28
-
-
Save Pebblo/63e60f5cc060052b89f22feef8a337d8 to your computer and use it in GitHub Desktop.
Example of how to add a custom message shortcode to the EE_Datetime_Shortcodes library.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* This filter allows you to add custom shortcodes to the message system | |
* $shortcodes is an array of the available shortcodes for the current library | |
* $lib is the current shortcode library | |
*/ | |
function ee_register_new_custom_messages_shortcodes( $shortcodes, EE_Shortcodes $lib ) { | |
//Add a shortcode to be used with the EE Datetimes within messages | |
if ( $lib instanceof EE_Datetime_Shortcodes ) { | |
//Add your shortcode to the add as the key, the value should be a description of the shortcode. | |
$shortcodes['[DATETIME_ID]'] = _('The ID of the current Datetime'); | |
} | |
//Return the shortcodes. | |
return $shortcodes; | |
} | |
add_filter( 'FHEE__EE_Shortcodes__shortcodes', 'ee_register_new_custom_messages_shortcodes', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment