Colin Devroe

Photographer. Podcaster. Blogger. Reverse Engineer.

Hacking rather than waiting

Yesterday afternoon Sarah Pressler retweeted Jono Young’s request for a plugin that would add a submenu to the WordPress’ Admin with the current pages for the site under the Pages menu. This would reduce the number of clicks to get to the page editor.

I was waiting for an upload to finish and I thought, given the code I have laying around from other projects, I’d be able to supply Jono with something passable for what he needed. Though it is far from what I would recommend using, it is a start.

Here is what I did:

  • I used get_pages to get a list of WordPress pages the were published.
  • While looping through each page I used add_submenu_page to add the page titles under the Pages menu
  • I used JavaScript to replace the HREF attribute on the links to link to the page editor

That last step is the hacky part in my opinion. add_submenu_page() asks for a function name to call to build the page for the menu item when it is clicked. In other words, for each item on the Admin menu there is a corresponding function that will show you the page that it results in. But I didn’t want to create a new page, I wanted the link to go to the page editor.

I dug around for five minutes or so and I didn’t see an apparent way to change the links for the page titles (though I’m sure there is a better way if I had the time to continue looking) and so after the page loads I use JavaScript to replace the attributes with links to the page editor.

Nowhere near perfect but, in a pinch, it is one step closer to what Jono wanted. Hopefully he or someone else can build upon and it make something a little more reliable and less hacky.

You can see the source on Github.

Your blog doesn’t need to make money

Sarah Pressler, on her blog:

But the thing is you can just write for the sake of sharing your thoughts with the world at large. Or mostly, just for the sake of getting your thoughts out of your own head.

It is true. Your blog does not need to make money. You do not need to track analytics. In fact, I believe you are better off if you do not do so. Do not look at your readership numbers, your follower counts, your “hits”. Ignore that. Just write.

Three years ago, I wrote:

But writing, for me, is my way of deep thinking. I then get to edit my thoughts. What a beautiful idea! To write something down that you’re thinking about and, rather than the thought simply going away, you can go back and and begin to craft that idea and mold your own opinion until you can fully come to a conclusion.

It is still true for me today. Writing is how I get things out of my head and can form firm opinions of those things. Sometimes I publish those thoughts, other times I do not. But I have no idea how many people read them.

Side note: If you look at the source code for my site you will see Google Analytics. It is because my site is powered by the Barley platform – which tracks all page views. But I do not look at them personally. Probably haven’t looked too closely at those numbers in a few years.