Hide the page you’ve set to show Posts in WP Admin

One of my many annoyances with WordPress is how you need to create a page, and assign that to be the Posts archive page, if you want a static home page and Posts elsewhere. This usually means having a page in WP with the editor saying something like “Don’t delete this page, it’s pretty important!”.

I found this answer on SO, and adapted it to suit my needs.

function origin_hide_posts_page_in_admin($query) {
if (!$query->is_admin() && !$query->is_main_query()) :

global $typenow;

if ('page' == $typenow) {
$query->set('post__not_in', array(get_option('page_for_posts')));
add_action('pre_get_posts', 'origin_hide_posts_page_in_admin');

So, now the page I assigned to be the Posts page is now hidden. Much better! If I ever need it again, just comment out that function.

July Update

Last June, I did a general update about me, work, houses, cars, Kodery, and more. It’s been a year, and a lot has changed, and more is going to change in the coming months too. So it feels like a good time to do another update.


I started writing this paragraph saying that nothing much has changed. But then I realised that quote a lot has changed.

My face still hasn’t worked out that I want it to grow a proper beard, and I’m still as skinny as ever, but I’m eating lunch most days. Whilst I’m still not generally looking forward to eating like most people do, I’m trying to make an effort to eat at more sensible times. I can’t remember the last time I had breakfast though.

I’ve also put more effort into sleeping at a sensible time. I’ve stopped listening to podcasts as I fall asleep which seems to have helped a little bit. I’ve also been trying harder to not sleep past my alarms going off. This is not a spring, but a marathon, and I feel I’m on the 10th mile.


My little company turned 2 years old in May, and last year I had 22% increase in turnover. My the end of May 2018, I would like to see a 30% increase over 2017.

I’ve had a little more variation in work too, with numerous projects from 4 clients. I’m about to start some projects for 2 new clients too, so it looks like my client base will grow slightly. This is something I’ve wanted for a year, as diversity of income can only be a good thing. If I lost one of those 4 clients last year, I would struggle to make ends meet. With 6 clients, I’m finding my calendar booked up most of the time, so I can invoice more often, and if I did loose one of those clients, it won’t be too much of a struggle.

House Hunting

We needed to wait for the business to turn 2 years old before my income could be accounted for in a mortgage application. The day came, the books were done, and we booked an appointment with a mortgage advisor my accountant recommended. We went and saw him, and were frankly stunned with what we could borrow.

The past few months were filled with looking at online ‘how much can you borrow’ calculators and inputting the figures in various ways, and ether getting a result that meant buying a caravan, or mansion in the city. We really didn’t know what to think, but were expecting an offer on the low end. So when we were told what we could borrow, I was overjoyed. It isn’t a huge amount of money, it’s probably low compared to many, but it means we can buy an average sized house for the more built up areas of South East England.

We’re viewing a property this weekend, and it all goes well, we could be in within a few months.

Me choosing to start a limited company instead of being a sole trader might just be the best business decision I’ve made so far. I know of a couple where 1 person is a sole trader and they’re finding it impossible to get a mortgage, and I think they combined earn more than us.


I didn’t talk about the wedding last year, because we hadn’t progressed with anything, this year is the opposite. Most wedding suppliers tend to work a year in advanced, so now is the time to look at dresses and florists. We first booked the venue, and within a couple of weeks had the photographer and cake sorted. Hayley has now bought a dress1, as have an appointment with a florist next weekend, and I’m waiting for autumn to get my suit.

This Blog

Did you notice it changed? Didn’t think so, my average daily visitors is in single digits. I’ve re-built it on Jekyll, and added the ability to do link posts.

There’s always things I want to share with a quick bit of text, but they get lost on Twitter2, so they’ll go here instead. Cool videos, interesting articles, whatever takes my fancy. For years, I tried to keep a theme to this blog, but it should be a feed of whatever the fuck goes through my head that’s safe to publish, so that’s what I’m going to do.

Anyway, things may be broken. There’s no vendor prefixing at the moment, and no images are optimised, but it’s a start.

  1. I haven’t seen the dress, obviously. All I know it that’s ivory in colour, I think? 
  2. I should do a post about Twitter. It might just be the people I follow, but it now feels like a news feed and platform for arguments instead of a place for pleasant conversation. 

Late Nights

I’ve written a few times about how I tend to work better at night. Trouble is, it’s not sustainable.

What typically happens is, I get some requests in from clients to do little jobs (quick 30 minute things). I don’t like having those sit around, so I try to do them all in one evening, but they inevitably stretch over to the next day, and that puts me behind on larger projects. I then need to work later to catch up on those, but that then ruins my sleeping pattern, and the only time I’m productive is late at night.

Take today for example, I woke up around 11am, It takes me an hour or so to get into the right frame of mind to code, then I work for a few hours. Then dinner comes, and I lose my streak. I then get back into the right mindset about 10pm, then work ’till 1/2am, and eventually fall asleep about 3am, if not later. That then affects my eating habits, because my sleeping pattern is about 5 hours behind my eating patterns. I can count the number of times I’ve had breakfast in 2017 on one hand.

Spread over the day, the hours I do work constitute a full day, but I really don’t like it. It means I’m constantly feeling anxious about not having done enough work yet, and having the energy to ‘catch up’ later that night.

Anecdotally, I remember John O’Nolan telling me that when he turned 25 (or 24, not sure now), he suddenly started waking up early in the mornings, like a switch was flicked in his head. Given that I’ve struggled with this shitty sleeping pattern for about 6 years, I really hoped that would happen to me. Obviously, it didn’t, and I need to do something about it.

I’ve said countless times that I need to do something about this, but I’m starting to see it affect my health  too, mostly down to eating, like I mention above.

I’m not sure what the solution is yet. It could be to slowly force myself to get up slightly earlier each day with some form of incentive like a beer in the evening, or something more drastic like rigging up a cup of water above the bed that is set to tip over me at a certain time, if it senses me in bed still.

I think the first logical step is to try more alarms, so let’s see how this goes.

2016 In Review

For the last couple of years, I’ve done a month by month review of the year. After seeing Remy Sharp’s post, I thought that was a better format, so I’m copying the idea. Given that a few months would just be summarised as ‘work’, it feels more appropriate.


My little company, Cross Stroke, turns 2 this year. I will do a more detailed post like this on the Cross Stroke blog (which I need to build) in May. But, some highlights of the year would be:

  • Started using OmniFocus to manage my tasks. After hearing ;a couple episode of Canvas by Federico Viticci and Fraser Speirs (part 1, and part 2), I was compelled to pay for what is – relatively speaking – an expensive todo app. I’m glad I did though, and I’d buy it again if I needed to.
  • Used a calendar to book in blocks of time and, for the most part, kept on schedule.
  • Started saving money for tax bills, so no late nights and rushed work when those bills come around.
  • Drastically improved my work ethic, and now treat it as a separate business, not an extension of me. It is a limited company, and I might run it, but it should be treated and thought of as a separate entity.


2016 was a bit of a blur for me. Most of my attention was on the business, but there were definitely some great highlights.

  • Hayley & I visited Disneyland Paris twice, making it a total of four times in two years. We’re saving the next Disney trip for our honeymoon in 2018.
  • Very recently, we passed a huge milestone in saving for a mortgage deposit. I’m not going to say what we have saved, but suffice to say we’re over the 5% required the sort of house we’re after.
  • I picked up the second Focus ST3 after Ford missed an option on the purchase sheet that I was paying for.
  • I drove around Wales for a couple days in May, and found out sleeping in the back of a Ford Focus isn’t the most comfortable, but doable. I also found out all of us having a CB radio is amazing. I wish I got more photos and some video of it, so there’ll have to be another trip for that!
  • I bought a top-spec 27″ 5K iMac, and it’s amazing. I’ve been a laptop guy since 2008, so it was a paradigm shift for me, but well worth it. Having one place I sit and work has helped me focus.
  • Hayley & I spent a couple days in Nottingham at a fancy hotel, to get away from our Mac’s for a while. It was lovely.
  • I drove over 1000 miles for 2 conferences in the North of England.
  • My sleeve tattoo had a little addition; a stag. I didn’t realise it was in vogue before we did it.
  • My neighbour (of 20 years) got married and we went to the wedding. it was set in a lovely little country house.


I’ve written several times about planning big changes in how I live and approach things. Turns out, those homes and aspirations are just words. If I tackle one thing at a time and don’t give it much thought, I’m far more likely to succeed.
However, I do have a few things I’d like to do in 2017:

  • Try my hand at making a weekly video. I hope the pressure of trying to make it interesting will help me seek out a little more fun and variety in life. I suspect it’ll start out as a weekly vlog, with the occasional fun trip and adventure.
  • Keep making steady progress on my eating patterns.
  • Tying in with eating patterns, try to improve my working hours. When we do buy a house, working from 8pm to 2am isn’t something I want to force Hayley to live with.
  • Learn all I can about the process of buying a house, so when we do, I know all the options and processes, and am well prepared for the whole thing. That means the mortgage stuff, kitting the house out, and what running a limited company from home means.

Back To Kodery

Back in December 2015 I wrote about the future of Kodery, my little code snippet storage app I started in 2009, when I didn’t have lots of grey hair.

I sort of forgot about it, but in the last month or so, I’ve found myself using it more and adding more snippets. That promoted me to go and look at the results of the poll, and after reseting my password because I forgot it and didn’t put it in 1Password, I saw the numbers.

Charge a sensible amount 24 44.44%
Close it down 13 24.07%
Sell it 17 31.48%

That’s 54 people who replied, and of those who replied 75.92% want it to keep alive, whether I charge for it, or sell/give it to someone else. Even though those numbers are tiny, it’s given me a little hope. Somebody wants it.

The past few months of work have been very monotamous and haven given me much room to experiment with new things. I’m not complaining, it’s paying the bills nicely and I’m certainly not going to shun these projects – I’m comfortable doing them and enjoy large parts of it. But it has made me want to revisit some side-projects and kick some life back into them.

Given that I’m using Kodery more recently, it makes sense to put some effort into that, so I’ve come up with a little plan.

  • Clean up the UI a bit
  • Fix some bugs
  • Add the ability to take payments and add restrictions to free accounts1. Those restrictions won’t affect current users viewing snippets already there, but you won’t be able to add more.
  • Add a few other ideas I have, like the long-awaited code editor plugins2

I have no timeline for this, but it looks like I might be able to fit in a few days for this early September. Wish me luck!

  1. Such as up to 20 snippets for free, not entirely sure yet 
  2. Probably for Atom & Sublime from me, others can make their own 😊 

Next & Previous Post Links in the Same Taxonomy

If you use Custom Post Types with custom taxonomies in WP, you’ve no doubt wanted to add Next & Previous buttons on the single-cake.php template that keep the same taxonomy term as the page they sit on.

As a loose example, let’s use cake. cake is our CPT, and we have a custom taxonomy of flavor. We have a few terms there of chocolate, lemon, and strawberry.

We’re looking at a chocolate cake, and we want a button at the bottom of the single-cake.php template that says Next Chocolate Cake1. So we need a way to link to the next cake that’s also a chocolate cake.

$prev_post = get_previous_post(true, false, 'flavor');
$next_post = get_next_post(true, false, 'flavor');
  • true means we want the next/prev post to be of the same term (‘flavor’ in our case)
  • false means we don’t want to exclude any ID’s here
  • flavor is our taxonomy

In the past, I’d have some something with a WP_Query loop, but now I know this exusts, I don’t need to!

There’s more info on get_previous_post() and get_next_post(), so read the docs!

  1. You’ll need to do something with get_the_terms() to get the current taxonomy term. 

Event Date Sorting Columns for WordPress CPTs

On a recent client project, one of the requirements was adding a couple admin columns for a custom pst type type to sort things by start date and end date.

It was a slight faff to work out how this should be done, so I’m plonking it here for me to find in the future.


The complication here was wanting to show the date in a human-readable format whilst letting the sorting happen using the unix time stamp.

So, a few things to note:

  • event is the custom post type name. If it were cake, every action and filter name would need to be cake instead of event.
  • first_show_date and last_show_date are custom fields storing the Unix time stamp

Add a column to the admin

function event_cpt_add_columns($defaults) {
  $defaults = array(
    'cb'             => '<input type="checkbox" />',
    'title'          => 'Title',
    'firstshowdate'  => 'First Show Date',
    'lastshowdate'   => 'Last Show Date',
    'date'           => 'Date',

  return $defaults;

Add something to that new column

function event_cpt_column_data($column_name, $post_ID) {
  if ($column_name == 'firstshowdate') {
    echo date('jS F Y', get_post_meta('first_show_date', $post_ID), true);
  if ($column_name == 'lastshowdate') {
    echo date('jS F Y', get_post_meta('last_show_date', $post_ID), true);
add_filter('manage_event_posts_columns', 'event_cpt_add_columns', 10);
add_action('manage_event_posts_custom_column', 'event_cpt_column_data', 10, 2);

function event_cpt_register_sortable($columns) {
  $columns['firstshowdate'] = 'firstshowdate';
  $columns['lastshowdate'] = 'lastshowdate';
  return $columns;
add_filter("manage_edit-event_sortable_columns", "event_cpt_register_sortable" );

Enable sorting…

… using the original value of the custom field, not it’s formatted counterpart.

function event_cpt_orderby( $query ) {
  if (!is_admin())

  $orderby = $query->get('orderby');

  if ('firstshowdate' == $orderby ) {

  if ('lastshowdate' == $orderby ) {
add_action('pre_get_posts', 'event_cpt_orderby');

If this can be improved, do let me know!

June Update

It’s almost exactly six months since I wrote anything here. That’s largely due to me not having anything interesting to say, or interesting enough to share anyway. But a lot has happened in six months, so an update post on lots of little things may be interesting, or at least interesting for me to look back on.


The #60lbsswap thing seems to have fizzled out, I was shit at keeping up with it anyway. I’d never put weight on, just fluctuate a few pounds each week. Nothing ever stayed.

With that said, I have been making more of an effort to eat with more regularity – I had breakfast today! I’ve also been using some old weights to (very) slowly building some muscle. I accepted the fact I’ll never have a beach body1, I’ll always be skinny and most clothes won’t fit me in a flattering way. But I can do something to help, if only a little.

I’ve also been keeping up with applying Minoxidil to my jaw, in an effort to help fill a patch where very little hair has grown. It only bothers me because it is right on the jaw line, and looks like I slipped with the razor if I don’t keep it trimmed. I’d love a full beard for our wedding in 2018, and it looks like beard growing takes fucking ages!

Another thing I’ve been notoriously shit with is sleep. Granted, I write this at 1am on a Wednesday, but months ago that would mean not waking up till linch time. These days I can wake up around 9am/10am and feel okay. It’s not the best scenario, but it’s a lot better than it was, and it steady progress in the right direction.


Cross Stroke is going well. I have enough work booked up until October to keep me warm and occupied. From May 2015 to May 2016, I earnt more than I would’ve if I stayed at Ghost on the same salary, and this year (May 2016/17), I have a wages strategy that is relatively easy to maintain and means money can start building up in the business for rainy days.

You can see here that money in the bank was very peaky last year, it’s now slowly starting to rise.

Money in the bank over the past year

In terms of growing the business, I’m going to maintain what I have at the moment until we’ve got a house, then I can be a little more aggressive with streamlining workflows, finding more clients like the awesome clients I have, and looking into the first hire.

Away from the financial side of things, I’ve slowly been getting better with keeping to deadlines, scheduling work properly, and keeping it all organised. Every project has a Git repo, a TaskPaper file, and time marked off in the calendar. I know it’s simple, but it’s a huge step from how I used to do things.

In the next few months, I’m going to have some branding done for Cross Stroke. No matter how many times I try to do it myself, I’m never happy with it. I’m really looking forward to having an official .eps file and brand guidelines!

House Hunting

Thanks to that mounting of cash I have in the business2, we’re one step closer to being able to buy a house. We’re a long way off yet, but with me being self-employed and the higher earner, I know whoever lends us a mortgage is gonna want to know lots about the business. Having enough cash stashed away to pay my wages for a few months is surely gonna help, if only with my stress levels.

The nest step is do all the necessary paperwork the lenders will need about my business, then re-ignite talks with a recommended mortgage advisor, see what we can borrow, then go hunting.

I’m confident we could either have moved in by the end of the year, or have done whatever needs to be done to buy a new house, because new houses come with certain financial benefit for first time buyers in the UK.3


Remember this post from December asking what to do with it? I still have no idea. It costs nothing to keep it running, so I’ll let it sit until I have a better idea, or the inclination to do something.

Other side projects

I’d still like to re-write my WP starter theme. I know there are many, I want my own for the same reason there’s a fuck-ton of CSS libraries – the existing options don’t fit my very well.

When I find a spare week (July looks good for that), I’m going to prototype a joint venture i’m working on with a client. It’s very interesting, beautiful, and right up my street. More on that later.


If you follow me on Twitter, and don’t skim past any car-related tweets4, you might remember Ford miss-ordered my black Focus ST, so, after some bitching and moaning, they let me order another, giving me a chance to change some specs.

I changed to the silver paint, larger 19” wheels (which also means better standard-fit tyres), and privacy glass. The car does look great in black, but black paint doesn’t sty black very long. I’d spend half a day perfecting the paint, then a day later, it looks like I haven’t bothered.

I event cleaned this silver car in a month (apart from removing bird shit), and it still looks alright. I didn’t choose silver an excuse to not wash it, but I’m a busy guy. I still give it the same attention, but I don’t feel embarrassed driving it ‘dirty’, like I did wth the black paint.

  1. Whatever the fuck that is… 
  2. I like to cash it out, make a throne of £50’s, rub it all over myself, then give it back to the bank. 
  3. Knowing my luck, that’s something #brexit would’ve fucked up. thannnks… 
  4. I don’t blame you, their either rants or dreams. 

2015 In Review

Like last year, this year has been good. And as ever, plenty of ups and downs.

January was a fairly quiet month.

February was also fairly quiet, except Hayley & I booked a trip to Disneyland Paris.

In March, I asked Hayley’s dad for his permission to propose, we went to Disney, and I proposed. it was lovely 🙂
I also left Ghost.

I spent all of April searching for my next venture, ultimately settling on going freelance again, with a forward-thinking view of starting an agency.

May was when I decided on a name for the company, and got everything legally sorted. Accountant, business bank, Companies House stuff, yada yada yada.

In June, I ordered my new car, my brother also got married – I was best man. It’s scary.

August was full of work for me, and burnout.

September saw me, Haley, and her parents fly to Nice for a week of cocktails and sun. I also picked up my new car hours after landing.

In October, Hayley & booked another trip to Disney.

In late November, we travelled to Disney again, but I drove this time. It’s cheaper, easier and more comfortable.

December, was just another normal month, aside form the couple weeks off at the end.

Other Improvements

It’s now been 17 months since I stopped smoking cigarettes, but I still vape daily. I did enjoy smoking, but I’ve lost the desire now. There’s no feeling of tabboo when someone offers me one on nights out. Through no effort, I’ve also seemingly convinced a few friends to try vaping too.

I bought some minoxidil a few months back, in an effort to help a bald patch on my chin. For a couple months, I saw no real changes, but that patch has a few dark hairs in it now, which is awesome! By the time I get through every bottle I have, I might have a non-patchy beard!

I got an Apple Watch in June, so that’s nice.

Learning to separate work and life more has been a huge benefit to me. Given I plan to work (i.e. code) 6 hours a day, it means my typically later starts to the day don’t eat into the evenings. That means my sleeping pattern can be what it wants to me, work gets done, and I have time for Hayley in the evenings – the way it should be. That doesn’t mean I’ve stopped trying to wake up earlier though – i’d still like to start the days work at 6am and be done my the early afternoon.

And lastly, I have a much stronger sense of my finances. I now control how much I pay myself, when, and where that money goes once it’s mine and not the businesses. That in itself doesn’t change much, but it enabled me to plan a bit better. If business is good for a few months in a row (and continues to look good months ahead), I can give myself a little pay rise and pipe more money into our house savings. We’d like to buy a house in 2016, and we’re getting closer each day.

Of course there’s goals for 2016.

  • Start working earlier
  • Find another design agency client who use me for all their web dev work
  • Continue with the house savings
  • Grow that beard
  • Put on some more weight
  • Pipe-dream time: Put on a little muscle

On Kodery


I’m at a cross-roads with Kodery – I have a few options, but I don’t know what to do with it.

The last commit as almost a year ago – 18th January 2015. That’s mostly due to me having to prioritise paid work over it.

When I started building Kodery in 2009, I had a full-time job, no work-like balance sensibilities and no friends to keep be occupied – I could pour any spare time I had into it. That has drastically changed. I have a beautiful fiancée I want to spend time with, I know when to stop working, I enjoy playing pool, and driving with my friends.

I would like to keep the service running, because I have several ideas for it such as an API, embeds, better search, much-improved UI, and better permissions so it can fit much larger teams.

Ultimately, it comes down to time and money. I can only commit more time to it if it can pay its way. It’s never earnt me a penny.

This leaves me with a few options.

Option #1 – Re-work and charge

This is my favourite option.

This would involve some drastic changes throughout the code base to build in those aforementioned features.

  • A full REST API
  • Embeds (but not shitty)
  • Improved search
  • Much-improved UI
  • More extensive user permissions

It also means spending quite a lot of time building in the ability to charge. I’ve learnt that payments are really not simple – there’s so many edge-cases to consider, and this itself is going to take a lot of time. There’s also EU VAT bullshit to take into account.

Aside from that, I wouldn’t want to charge for something I’m not massively happy with, so I’d want to re-build several parts of the app, such as the underlying code that stores snippets and feeds them back to you. It’s not bad, but I’ve learnt so much in the past couple years that I know of any ways to really improve this.

Option #2 – Close it

To close it, I’d have to first build an export function, so you can export everything you’ve chucked into it over the years. Some people have hundreds of snippets, and I don’t want them do disappear as I delete the database.

After that, make final backups of the DB and code, then nuke the server.

Option #3 – Sell it

I’ve never really considered selling before, but it’s an option. I have a rough idea what I’d like to sell it for, but I’m keeping that close to my chest.

The code isn’t bad – it’s not full of glaring security holes, but I’m sure whoever bought it would have monetization in mind, and would want to build that in. I’d hope they’d want to do the same as me if I were to set it up as a paid service myself.

Help me choose

I don’t want to make any decisions without hearing form you first. Fill out the poll below to chime in. You can also email me at [email protected] if you have any thoughts. I’d like to hear anything you have to say.

The poll is now closed.