Custom shortcode



Last updated
Was this helpful?



Last updated
Was this helpful?
Was this helpful?
add_filter(
'yaymail_customs_shortcode',
function( $shortcode_list, $yaymail_informations, $args = array() ) {
$shortcode_list['[yaymail_custom_shortcode_new_order]'] = 'Custom shortcode test New order';
$shortcode_list['[yaymail_custom_shortcode_processing_order]'] = 'Custom shortcode test Processing order';
$shortcode_list['[yaymail_custom_shortcode_order_on_hold]'] = 'Custom shortcode test Order on hold';
return $shortcode_list;
},
10,
3
);function test_shortcode1( $shortcode_list, $yaymail_informations, $args = array() ) {
//It only runs when tested with real order
if (isset ($args['order'])) {
$order = $args['order'];
$order_id = $order->get_id();
return $order_id;
}
// in Yaymail will show it
return 'test_shortcode';
}
add_filter(
'yaymail_customs_shortcode',
function( $shortcode_list, $yaymail_informations, $args = array() ) {
$shortcode_list['[yaymail_custom_shortcode_test]'] = test_shortcode1($shortcode_list, $yaymail_informations, $args);
return $shortcode_list;
},
10,
3
);