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.