Custom Placeholder

Custom Placeholder Filter

After the plugin collected all data to be written in your mails, invoices and results pages I’ve introduced the first filter for this plugin in version 2.2.

You can use the filter “shopstyline_placeholders” to access, modify existing placeholder or append your own one.

In case you want to append a random number as a custom placeholder to your mails, you can use the filter as follows:

 

add_filter('shopstyling_placeholders','my_shopstyling_placeholder');
function my_shopstyling_placeholder($params){
    $params[] = array(
                        'unique_name' => 'random_number',
                        'value'       => rand()
                    );
    return $params;
}

The array $params contains all existing placeholders as pairs of ‘unique_name’ (the placeholder name) and ‘value’ (the replacement)

Leave a Reply