Skip to main content Skip to navigation Skip to footer

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 adding the first code block below as an example shortcode, followed by the second code block. 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' );
}, 1, 1 );

add_filter( 'wp_mail', function( $args ) {
$args['message'] = do_shortcode( $args['message'] );
return $args;
}, 1, 1 );

Privacy Overview

This website uses cookies so that it can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to this website and helping employees to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

This website uses the Stripe Payment Processor. Cookies from Stripe are required in order for this website to provide eCommerce functions, such as to accept payments.

This website uses YouTube to host and display videos relating to the operation of this plugin and forms part of the documentation. Use of cookies from YouTube is required in order to fully document or explain elements of a product.

PHPSESSID - This cookie is native to PHP applications. The cookie is used to store and identify a users' unique session ID for the purpose of managing a user's session on the website. The cookie is a session cookies and is deleted when all the browser windows are closed.