Adding Your Own Custom Shortcodes
Updated
If you would like to add your own custom shortcodes to posts, pages, or custom post type notifications using BNFW, you can do so by following the below example, adding the first code block below to create a new shortcode, followed by the second code block to render the shortcode. Both parts are required to create the shortcode correctly. These are added to your functions.php file.
This will inform BNFW of the new shortcode so that you can use it in your BNFW notifications.
If you want to use custom shortcodes in New User Registration notifications using BNFW, you’ll need the Custom Fields add-on.
If you need help with this, you may need to enlist a developer to write the code you need to add the shortcode you want to output in the message body of your notification(s).
function bnfw_shortcode_futuredate() {
$future_date = date( 'F j, Y', strtotime( '+1 year' ) );
return $future_date;
}
add_shortcode( 'future_date', 'bnfw_shortcode_futuredate' );
add_filter( 'wp_mail', function( $args ) {
$args['message'] = do_shortcode( $args['message'] );
return $args;
}, 1, 1 );