Adding a Sendy shortcode to WordPress

Just now I decided to give Sendy a go for my mail lists. I wanted something a bit more self hosted than your usual Mailchimps and something a bit more robust than Mailgun lists.

The only problem – Ain’t no plugins to add a Sendy form as a shortcode! So I wrote a plugin for it. It’s nothing major and only a single file plugin for now.

The raw code is here (in all honesty, to pad out the length of this post) and you can grab it as an easy upload-to-install plugin here ->


[sendy id='SENDY-LIST-ID' width='150px']

Width is optional, it’ll go with 100% if you don’t specify it. If you don’t include id it’ll just break and do nothing.

Naturally you can see it in action with my own mail list page (.. and of course, feel free to sign up!)

Plugin Name: Sendy Shortcode
Plugin URI:
Description: Easy add Sendy subscribe forms using a shortcode
Version: 0.0.1
Author: Cohan Robinson
Author URI:
License: GPLv3

function sendy_form ($atts) {
	$attribute = shortcode_atts( array(
	    'id' => 'xxx',
	    'width' => '100%'
	), $atts );

	<style type="text/css">
		.sendy-form {
			width: <?php echo $attribute['width']; ?>;
		.sendy-name {
			width: <?php echo $attribute['width']; ?>;
		.sendy-email {
			width: <?php echo $attribute['width']; ?>;
		.sendy-submit {
			width: <?php echo $attribute['width']; ?>;
			margin-top: 10px;
			margin-bottom: 20px;
	<form class='sendy-form' action="" method="POST" accept-charset="utf-8">
		<input class='sendy-name' type="text" name="name" placeholder="Name" />
		<input class='sendy-email' type="email" name="email" placeholder="Email address" />
		<div style="display:none;">
			<input type="text" name="hp" placeholder="HP" />
		<input type="hidden" name="list" value="<?php echo $attribute['id']; ?>"/>
		<input type="hidden" name="subform" value="yes"/>
		<input class='sendy-submit' type="submit" name="submit" />
	return ob_get_clean();

add_shortcode('sendy', 'sendy_form');

Leave a Reply