WordPress Contact Form 7 Postcode plugin

Some genius at work pointed out that the contact forms on the works web site weren’t validating properly.

Whoops, my bad.

So I changed the email and telephone inputs to their proper HTML5 types, but there was the postcode box that the spammers where filling in with crap, so I wrote this plugin for Contact Form 7 that adds [postcode] tag to the form creator in the backend, with the usual id, class and required options.

It’s free to use and abuse as you feel necessary, just a link back to the original would be nice.

Download here.

WordPress plugin to replicate Pluralsight’s search

The development team are being reskilled (NOT retrained) to use technologies for mobile apps like AngularJS and MVC5 and as we’re MSDN members, we get Pluralsight free 🙂

So we all get our subscriptions through and the first thing I notice is the search.

live-search-pluralsight

That’s nice, so my mind is already writing the code in my head, but I’m a lazy shit so can I rip it? Nope, it’s in ReactJS.

Bollocks.

Ok, let’s break down each step and write it in jQuery. For WordPress. As a plugin. Piece of piss.

Ta dah!
Ta dah! If I could get my own domain URL right. Duh.

This is provided as is. It’s very basic, no responsiveness, no options and written and tested in Chrome. Sure it can be improved greatly, but this was just me messing around more than creating a finished project.

Download it here, add it to your site and activate.

After a little bit of tidying, I’ve added it to GitHub along with other shite I’ve done.

If you want to reconfigure it, you’ll have to edit the files and colours and stuff.

Try the search box on the left hand side on this blog and you’ll see it in action.

Yop Poll WordPress plugin: Changing class of button and add FontAwesome

Since moving over to a new theme on the works web site, it’s been my mission to change the INPUT and BUTTON tags to match, and sometimes it’s just not possible without massive duplication of CSS.

In this morning’s example, I wanted to get rid of the styling imposed by Yop Poll and put Twitter Bootstrap’s btw classes in it’s place, and I’m not in the mood for a little thing like a lack of customisation or specifying classes beat me.

We want to look at this section.
jQuery(document).ready(function(){
runOnPollStateChange_%POLL-ID%();
});

The id button is #yop_poll_vote-button-%POLL-ID% in the template so the jQuery script is:

jQuery( "#yop_poll_vote-button-%POLL-ID%" ).removeClass( "yop_poll_vote_button" ).addClass("btn btn-default");

Ta-dah! But we’re not going to stop there. We use FontAwesome, it would be nice to have that as well wouldn’t it? Well let’s do it, using the same ID, we can just prepend to the HTML in the button.

jQuery("#yop_poll_vote-button-%POLL-ID%").prepend('<i class="fa fa-check-square-o"></i>');

And if you are going to ask how to put the icon AFTER the text then you should be ashamed of yourself and step away from WordPress!

And in the words of Jimmy Saville (whoops, probably triggered someone there), “how’s about that then.”

List Custom Taxonomy Widget v3.4 (forked)

Working on a WordPress support site for the last week or so, and we wanted to display sidebar dropdown menus for the many taxonomies we’ve created to help support agents find the correct content.

WordPress built in widgets don’t let you choose custom created taxonomies so the hunt was on for a way to do this. Instead of doing some work, I found the List Custom Taxonomy Widget, which suited our needs perfectly. And yet I wasn’t happy with it. For a kick off the submit button says “go »” , the 1990’s called and want their call to action indicator back.

The changes I made to fit my needs for this web site:

  • If FontAwesome Menus is installed show a FontAwesome input box for icon (fa-search for example, see FontAwesome Cheatsheet for the complete list)
  • Custom text on button, default to “Go »” (the 1990’s called again)
  • Add onchange option (The button will still be shown for accessibility purposes. And truly stupid people who need to see a button(!))

Download here and upload to your web shite.

Just for a change, I thought I’d have a blog post that actually involves what I do for a living. Don’t worry, the abuse will continue soon enough