Project Completed: Election Odds

I’ve been a bit off-colour this week. Mini-manflu as I call it. No need for any sympathy – I’m just mildly under the weather. Completely capable of doing stuff, no need for daytime naps or anything – but just not the head to be dealing with complex JavaScript or similar.

Also it was taking me until 11am to get going most days, instead of my usual 8am start.

So I decided to take a break from the project that is quite the challenge (I spent about 3 hours on those hills and I’m still not happy with them – feedback/advice welcome) and just do a nice little WordPress upgrade for a blog.

The story is, that I had a blog called Political Betting.  I would occasionally write up tips on bets that I was placing, though I only ever had a page on Facebook, and a Twitter account (and I do make a slight profit on my political bets – although this is more than wiped out by my useless football bets).

My first challenge was what to name it.   politicalbetting.co.uk would have been ideal but this is a long-established site (of which I was not aware of its existence prior to setting up my Facebook page).  I considered politicalbettinguk and similar ideas but they were not catchy enough.

I then used Google Adword’s keyword search and it had two main suggestions as to the most-searched terms – Political Betting and Election Odds.

Election Odds.  Brilliant.  So the question of what to call it to make sure it stood out was completed.

I had in my head what I wanted it to look like – I’ve mentioned this before that I find the design side frustrating as I know what good code looks like, but I don’t always get the design right.  My idea for the home page was a large hero image of Westminster to take up the main page, with previews of posts outlined below in a grid system.  The sidebar would be on the right-hand side, with details of all the free bets available from bookmakers (affiliate links – I need to try to pay the bills somehow!).

I spent around two hours playing with my ideas, started making my own theme when I realised that WordPress’ new default theme, twentyseventeen, did exactly what I wanted it to do, well 75% of what I had envisaged.  There is no point in re-inventing the wheel, especially when it wasn’t going to teach me anything new.  I know how to style.  I know how to do layouts.  I don’t need practice in styling themes.  What I wanted was more practice with WordPress functionality.

Deal.  A couple of days saved.

Speaking of WordPress functionality, for this project I set up several custom taxonomies to be used, along with some custom post types – something alien to me a couple of months ago but which I am now very comfortable with.

There are still improvements to be made, particularly including learning how to make filters, so a user can, for example, select the betting market (custom post type) and be shown just the posts relating to that particular betting market.  I don’t think that I am too far away in my knowledge.  I also need to learn how best to dynamically style my posts.  At the moment, I have styles set up in my style sheet to add different coloured bottom borders on the home page, depending on what the party custom post type is, using get_the_term_list( $post->ID, ‘party’, ”, ‘, ‘, ” ) to retrieve the party name for that post ID, and setting it to a variable, which then updates the class.

But there must be a more dynamic way of doing so, as if I need to add a new party, I also need to update the stylesheet.

I thought the answer might have been with post_class() – which was the one new thing I learnt.  Sadly I couldn’t work out how to get it to do what I wanted it to do.  Yet!

The site is now up and running.  Clearly with just one post it looks a bit basic, and I will likely make improvements as time goes on once there is more substance.  For now, another project ticked off the list and time to go back to my WordPress book for the rest of Saturday, to see if I can figure out any of the aforementioned improvements that I require.