Shortcode.php
27 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Helpers\Frontend; |
| 4 | |
| 5 | class Shortcode { |
| 6 | /** |
| 7 | * Get give_receipt shortcode with attributes from confirmation page. |
| 8 | * |
| 9 | * @return string |
| 10 | * @since 2.7.0 |
| 11 | */ |
| 12 | public static function getReceiptShortcodeFromConfirmationPage() { |
| 13 | $post = get_post( give_get_option( 'success_page', 0 ) ); |
| 14 | $content = $post->post_content; |
| 15 | |
| 16 | if ( ! empty( $content ) ) { |
| 17 | preg_match( '/\[give_receipt(.*?)]/i', $content, $matches ); |
| 18 | |
| 19 | if ( isset( $matches[0] ) ) { |
| 20 | return $matches[0]; |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | return ''; |
| 25 | } |
| 26 | } |
| 27 |