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.

Update 2018/06/01: Updated the plugin to add the “url” attribute.. the original was er, sorta sending you to my mailer. Whups.

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 url='SENDY-URL' id='SENDY-LIST-ID' width='150px']

Width is optional, it’ll go with 100% if you don’t specify it.

It generally wont work if you don’t specify URL and ID

It’s the ID column there, mine starting “3DMP” – if you hover over that you can grab and copy your ID

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: 1.0.0
Author: Cohan Robinson
Author URI:
License: GPLv3

function sendy_form ($atts) {
$attribute = shortcode_atts( array(
'id' => 'xxx',
'width' => '100%',
'url' => '',
), $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="<?php echo $attribute['url']; ?>/subscribe" 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" />
<input type="hidden" name="list" value="<?php echo $attribute['id']; ?>"/>
<div style="display:none;">
<input type="text" name="hp" placeholder="HP" />
<input type="text" name="gdpr" value="true" />
<input type="hidden" name="subform" value="yes"/>
<input class='sendy-submit' type="submit" name="submit" />
return ob_get_clean();

add_shortcode('sendy', 'sendy_form');

Sign up for emails about the things

You're signing up to a rather infrequent mail list where I let you know about the new things going on.
All the messages have an unsub link in them and I'm never going to sell, trade, or otherwise hand over your contact information to anyone.
You'll not be signed up to any new lists either, because I hate it when places do that to me too