Last active
February 27, 2017 07:03
-
-
Save sabbir1991/de780ed26390c33a029f26a52dd56d93 to your computer and use it in GitHub Desktop.
Add extra shortcodes in sms body
This file contains hidden or 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 | |
//Add new shortcodes | |
add_filter( 'sat_sms_get_order_shortcodes', function( $codes ) { | |
$codes[] = '[order_pdf_voucher]'; | |
return $codes; | |
} ); | |
// For displaying your shortcoders in backend settings | |
add_filter( 'sat_sms_shortcode_insert_description', function( $content ) { | |
return $content . ' For PDF voucher add [order_pdf_voucher]'; | |
} ); | |
// For modifying the sms body with including your shortcoders. | |
add_filter( 'sat_sms_pharse_body', function( $body, $data ) { | |
$vaoucher_code = get_post_meta( $data['order_id'], '_order_key', true ); | |
return str_replace( '[order_pdf_voucher_code]', $vaoucher_code, $body ); | |
},10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment