Building WPVote Part 5 : Programming

I’m nearly finished with the design of my new WordPress voting site, WPVote, so now need to look more closely at the programming.

I enjoy dissecting WordPress themes, and since I also like code simplicity and minimalism (and am working with a child theme) I decided to strip out as much of the original WPVote theme as possible.

First I had to go through the theme files and work out which were normal theme files (archives etc) and which had special stuff going on (the voting functionality). I could then drop any files that duplicated functionality in Elemental.

Next I joined what was left into functions in the child themes functions.php. I was left with half a dozen files making things a lot easier to manage.

JavaScript isn’t one of my strong points but I like to learn new skills so swapped all the dynamic/ ajax functionality over to jQuery (before it was custom coded). This included the Ajax code – which is something I have I have even less experience with.

The original theme used WordPress custom page templates for the login and registration screens but I wanted to use the fewest number of files possible to make things as easy to set up as I could.

The reasoning behind this is that if I end up turning this theme into a premium theme then anything I can remove from the setup process is one thing extra that I don’t have to support.

What I did instead was use lightboxes with ajax pop-up windows for both the login/ registration screens and the article submission screen.

For the lightbox (and tabs, and tooltips etc) I went for the jQuery Tools library, which I also use extensively here on Binary Moon. It’s a really complete jQuery add-on and covers all the things I need for the average website. I’d recommend it.

The article submission page on the old WPVote site used the TDO mini forms plugin. It’s a cool system but, again, this would mean something else for people to set up, and supporting someone elses code is not something I want to do.

Luckily I was once working on a theme and plugin that were not released – it was a plugin version of the post submission element of the Prologue theme (now known as P2). So, I spent about an hour modifying that to fit the new WPVote theme. The big advantage of doing things myself is that I know how things work and am not relying on other developers.

Because so many elements of WPVote are publicly accessible security is a big aspect of the development and I am now looking at ways to harden up the data entry and make sure bots can’t be set to hack/ spam the site.

WordPress has a lot of security related functionality built-in, there’s a page on validating data input on the WordPress Codex which I have found really handy. I also intend to use Nonces to prevent unauthorised article submissions, along with CAPTCHA (which Elemental supports natively), and I am considering support for Akismet to stop spam entries in their tracks.

Additional functionality I will be adding are some new WordPress Widgets, to make the site customisation easier, and some new Dashboard Widgets for logged in users.

Next I will be looking at making the transition to a live site. Is there anything else I should consider adding/ developing that I might not have thought of?

Was it good/ useful/ a load of old rubbish? Let me know on Mastodon, or BlueSky (or Twitter X if you must).

Link to this page

Thanks for reading. I'd really appreciate it if you'd link to this page if you mention it in your newsletter or on your blog.

WordPress News

The latest WordPress updates from the WPBriefs Podcast.

Related Posts

29 Jan 2010

Building WPVote Part 7: Almost Done

Building WPVote has been a really interesting process for me. I have learnt stacks of new things, and through developing WPVote have added a stack of improvements to my WordPress Elemental.From start to finish I have: Building WPVote Part 1:...
01 Apr 2015

The State of WordPress Themes #wcldn

I recently spoke on a panel at WordCamp London 2015e. Lance – who used to be the Theme Team lead at WordPress.com – asked me if I wanted to speak on a panel with him at WordCamp London 2015. I’ve...
16 Sep 2009

What’s new with the Elemental WordPress theme?

Elemental is the upcoming theme framework for Pro Theme Design. It’s been in development for absolutely ages, and the code is really showing it’s maturity, and I am really pleased with the possibilities it opens up.The focus when developing Elemental...
13 May 2010

6 Tips to Build Better WordPress Themes

If you want to make WordPress themes, for clients, to release for free or to sell, then there are a lot of factors you need to take into consideration. Below are some hints and tips that should help ease your...
13 Oct 2016

Lessons Learned from 20 Theme Releases on WordPress.com

In 2007 I partnered with Darren Hoyt to release Mimbo Pro, one of the earliest premium WordPress themes. In 2012 Mimbo Pro was published on wordpress.com. Last week – on October 5th 2016 to be precise – my 20th theme...
02 Apr 2012

Building Elemental 2: Simplifying Through Reduction

One of the key things I wanted to do with Elemental was simplify it – and I mean this from a few different viewpoints. I use Elemental on this very website. Over time I have added new features and functionality...