Support » Plugin: Code Snippets » Good plugin

Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge


    Here’s a fairly basic example of how you could achieve that through a shortcode:

    add_shortcode( 'email_button', function () {
    	if ( isset( $_REQUEST['send-email-shortcode'] ) ) {
    		wp_mail( '', 'Email subject', 'Email message' );
    		return 'Email sent!';
    	$form = '
    	<form action="" method="post">
    		<button type="submit" name="send-email-shortcode">Send Email</button>
    	return $form;
    } );

    Once added as a snippet, you can add the [email_button] shortcode to a post or page. It will display a button, and when clicked will send an email and show a message saying it has done so.

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