Home / Admin / WP Simple Pay: Custom Smart Tag
Duplicate Snippet

Embed Snippet on Your Site

WP Simple Pay: Custom Smart Tag

Register a custom Smart Tag with PHP, and control the output.

Code Preview
php
<?php
/**
 * @link https://library.wpcode.com/snippet/924z3w1o/
 */
/**
 * Register a new {my-custom-tag} Smart Tag.
 */
add_filter(
	'simpay_payment_details_template_tags',
	function( $tags ) {
		$tags[] = 'my-custom-tag';
		
		return $tags;
	}
);
/**
 * Output a value for the {my-custom-tag} Smart Tag.
 */
add_filter(
	'simpay_payment_confirmation_template_tag_my-custom-tag',
	function( $value, $payment_confirmation_data ) {
		// var_dump( $payment_confirmation_data );
		
		$value = 'My custom value';
		
		return $value;
	},
	10,
	2
);

Comments

Add a Comment