Category: Development

  • Content Without Posts

    I’m going to demonstrate how to have a URL with content in WordPress that’s neither a post, page, or listing. Its contents can be anything you’d like! To do this we need to take the following steps: A Helper Class I’ve encompassed all these steps into a base class, which you can inherit from: To…

  • WordCamp Lancaster 2013

    I’m at WordCamp Lancaster, and I’ve given two talks. Here are my slides, and a selection of photos taken! A big shout out to: Code Deodorant How to determine code quality by scientific means and automation to help. Outside The Bubble What happened outside the WordPress ecosystem with PHP at large A video recording may…

  • Getting From URL to Template

    So you load a page on a WordPress site. How did it know to load the page template? How did it know it was a page and not a category listing? Is it hardcoded somewhere? To begin with lets list out what happens, then we’ll explain each step in basic terms: Before I continue, the…

  • Local Indicator v1.3

    After releasing v1.3, I thought I’d comment on the two significant changes I made. While there may be no visible change on the surface, new filters have been added to modify the colour and text of the indicator. For example, here’s code to change the colour to yellow: You can also change the text: Perhaps…

  • Realisations

    Some pretty simple things people don’t realise when dealing with WordPress Nobody Remembers the API A lot of people worry that they don’t know the API, that it will take them a long time to memorise everything. Nobody memorises the API. It changes too fast, it’s too big, and it’s a waste of time when…

  • WordPress: Necessary Reading

    WordPress APIs In brief, WordPress hooks enable you to change how WordPress behaves without editing any core files. Because you leave the WordPress files untouched, you can painlessly upgrade your blog with each new version of WordPress. It’s this hooks architecture that makes WordPress the best blogging solution. Adam Brown Best Practices Templating When you…

  • Audio.php

    A lot of the talk about, and the APIs for attachments are centered around images. After all it’s their most common use case by a huge margin. But what about audio? I won’t pretend this is a comprehensive guide, but considering the lack of basic examples, here’s how to implement a basic audio attachment template.…

  • Fixing Twitter OEmbed Language in WordPress

    A Twitter OEmbed returns tweets in the language of the requesting server, but say your an english site on a german server? You don’t want German retweet buttons! Here’s the fix. What Needs Adding The twitter OEmbed has some documented parameters, most notably, a lang attribute will fix the problem: So that lang attribute needs…

  • Auto-Grabbing Order Data From SellWire

    I’m going to demonstrate how to access order data programmatically from SellWire for a product. I’m going to be using this for building automation. Why Not Use SellWire APIs? At the moment SellWire provides no APIs, but they are planned. Until they are, some method of building automation is needed. To do this, I’ve programmed…

  • PHP Missing Methods & Levenshtein Distance

    I’m just going to leave this nifty little PHP snippet here, and recommend against it’s use. It could very well be shorter and more concise, probably a bit more performant too, but it works: View the code on Gist. It also encourages bad practices and ambiguity ( should elngth be mapped on to length1 or…

  • WordPress Flow Charts & Diagrams

    There’s a number of WordPress flow charts and diagrams in the community, to which the phrase worth their own weight in gold does no justice. For that adage to be true these charts would be so dense no light would reach them, rendering them utterly useless. So I’ve gathered a few of the more notable…

  • Typekit WP Editor Styles

    Ever tried putting Typekit fonts on a site then trying to style the editor text in the backend? After trying many solutions, such as putting it in the admin header ( didn’t work ), or embedding the JS code in the editor iframe ( typekit security killed this ), I found a solution that worked!…

  • ‘Hacker’ issues WP Pull Request on GitHub for PHP Shell

    At the beginning of September, a user by the name of  ‘maxymax’ forked WordPress, added a PHP Shell to the twentyten theme, and made a pull request to merge back in to the official release. https://github.com/maxymax/WordPress/commit/2fa93590c7881fab043be7b8b51358894dbc1466 Suffice to say the inclusion of Saudi Shell v1.0 in TwentyTen may not have been the best idea, nevermind…

  • New Plugin – Local Indicator

    I was having trouble telling apart development local and production servers, and wanted to prevent mistakes. So I built myself a plugin to help indicate what server I was on! Presenting local indicator, a simple tool to help tell apart local installs of WordPress and remote installs. It adds the IP and server name to…

  • Creating an Attachment for a File Already In Place

    There may come a time when there is a file in your uploads folder with no matching attachment post in the database. As unlikely as this is, it could happen, and when it does, it’s not clear how the upload mechanisms work. I came across a similar problem myself, here’s my code: View the code…