Support » Plugin: EZ Emails » Shortcode functionality

  • Hello!

    I just wanted to say first, thank you for the plugin, nice job! I really like it, and I’m using it both personally and professionally. I was writing today to see if you’d be interested in adding an update to it.

    Is it possible to allow for shortcode execution within a template? So far, as I can see, no, but I don’t think it should be that difficult to include it, should it? For example, the following code allows for shortcode execution through a filter for the widget area:

    add_filter('widget_text', 'do_shortcode');

    If you’re wondering the importance of including this feature, here’s my use case. You have a site wide email that goes out and at the bottom of the email it includes 5 recent news articles from a shortcode that has to grab the data first and then output the html code.

    I appreciate your time and effort,

    William Beeler

    https://wordpress.org/plugins/ez-emails/

Viewing 1 replies (of 1 total)
  • I believe this is the answer to my own question (If you want to include it in your plugin):

    add_filter( 'wp_mail', 'my_wp_mail_filter' );
    function my_wp_mail_filter( $args ) {
    
    	$new_wp_mail = array(
    		'to'          => $args['to'],
    		'subject'     => $args['subject'],
    		'message'     => do_shortcode($args['message']),
    		'headers'     => $args['headers'],
    		'attachments' => $args['attachments'],
    	);
    
    	return $new_wp_mail;
    }

    Notice the “do_shortcode(…” part. That’s what would fix the issue I’m having. This has been tested on my end, but not with your plugin.

    Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘Shortcode functionality’ is closed to new replies.