Disappearing Menus on Archive Pages in WordPress

Having recently been building a new site using WordPress, which utilised the handy custom post type functionality, I came across a couple of problems when building my theme. I’m posting the solutions here in case they prove useful.

Getting Custom Post Types to Appears in the Archives

You can use a custom page to display an archive of you custom post types, but I just wanted a single template (it’s a simple enough site). The problem is, only regular content types are included by default, so I used the code from CSS-Tricks:

function namespace_add_custom_types( $query ) {
if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
  $query->set( 'post_type', array(
   'post', 'your-custom-post-type-here'
  return $query;
add_filter( 'pre_get_posts', 'namespace_add_custom_types' );

That all worked lovely (modified to my data, obviously), but then I stumbled across a problem on the archive pages: my menu was disappearing. The Menu function is another I’m a fan of, due to the ability it provides to control your navigation, yet still access it via the control panel. Continue reading…

The Changing Landscape of Printing Costs

I wrote some tips a while back on buying a printer. The basic lesson was that for volume printing you wanted a laser printer and, if printing a fair amount, spend more on the hardware initially so you get the option for high capacity toner.

We’ve all seen the stories of inkjet printers that cost almost nothing, but soon seem less of a bargain when you come to buy new ink cartridges, which can cost more than the printer itself. The same is usually true for low-end laser printers.

The Changing Inkjet Market

Inkjet ink makes the price of crude oil look paltry (be very thankful you don’t use it to fill your tank), it’s expensive even compared to vintage Champagne. Added to that, a typical cartridge will only cover around 300 pages, and that’s without the repeated cleaning printers perform if you don’t print often enough.

There’s the old gotcha of tri-colour cartridges too, where only one colour needs to run out before you’re forced to replace the whole thing.

There are ways to drop the cost, whether that be aftermarket/re-manufactured cartridges, syringe refills or external tanks. Looking for printers that have separate colour cartridges and offer high capacity versions can also save you a lot too.

I’ve long shied away from recommending inkjets, but having spent a lot of time researching printers recently, I’m starting to change my view.

At the bottom end of the price bracket are printers that offer high costs per page (and for mono printing I’d class that as any over 1p per page), but many of the printer manufacturers are starting to fight back against the lowering costs of laser printers with improved ink prices and higher page counts per cartridge.

Separate colours are becoming a bit more standard and high capacity, which used to mean 500 pages instead of 300, can now mean several thousand pages, which pushes the cost per copy on a mono page to below 1p. Print speeds are up too, nearing laser rates. Continue reading…

Review of the Nexus 7

I was lucky enough to receive a Nexus 7 as a Christmas present, so having had it for a few months I thought it worth a quick write-up.

Nexus 7

I wrote a while ago that I didn’t think 7″ tablets were worth it, and for a while I wasn’t interested in them. I owned an iPad in any case. I did start to find I wanted to look things up while in a different room to my computer or the iPad and so having an extra tablet would be useful.

The improvements in tablets of that factor and the cost helped sway my desire. Then it came down to a choice of which one. The iPad Mini had not long been announced, the Kindle HD was coming to UK shores and there were offerings from B&N and Samsung as well as others.

I wasn’t interested in a cut-down Android experience, which ruled many of them out (the thought of rooting them didn’t appeal) and hence I hinted on my desire for the Nexus, as it came with an unfettered version of the latest release. Continue reading…

Lessons Learned Going Offline with HTML5

I recently built a simple web-based CRM tool only to run into a problem: my users didn’t have internet access all the time, so couldn’t reach it when on the road. Primary use was going to be on phones and tablets, so I could have built a native app, but with both Android and iOS devices to support it would have meant learning two new coding environments or a framework which could publish to both.

Having played with some of the features in HTML5 I was aware it had the ability to work offline, storing data locally. So I did a bit of research and began knocking something together. I thought I’d outline some of the lessons I learned on the way.

Giving credit where it’s due, I leant heavily on Alex Gibson’s example, you can find his code on Github.

Making a web page available offline

To make a file available offline, you need to create a cache manifest. Some of the older tutorials I found name it with a .manifest file type (e.g. offline.manifest, cache.manifest) but this didn’t work for me, you need to name it with a .appcache file extension (e.g. offline.appcache).

In there you need to reference all the files and resources you want available offline, and you can also set which files should never be cached as well as what to do if someone tries to access a page which is not available.

To make it easier, I created a completely separate file (offline.html) to do everything I wanted when there was no internet access, using Ajax, in one page.

I did add support to my .htaccess for a cache-manifest content type, but it worked fine before I had done that. Continue reading…

How to Decide on a Processor

It used to be fairly easy to figure out how good a processor was in relation to another, the main manufacturers (Intel and AMD) had two lines apiece — one budget line (Celeron/Duron) and one performance line (Pentium/Athlon) — and the higher the clock rating (measured in Mhz/Ghz) the better it was. These days the raw clock speed is only one aspect of how fast a processor is and with the chip companies updating their ranges more often, using multiple cores and inventing their own benchmarks, it can be very hard to understand what exactly you’re buying. Now there is an argument to say we don’t need to worry about processors any more. Any chip offers at least enough power to do anything a user wants unless they plan to do lot of video rendering (and even then it’ll just be slower). While that may be true, I still recommend avoiding the budget end of the CPU spectrum when buying a new computer so you have a machine that’ll last as long as possible. The price difference is usually minimal and it’ll be more future-proof (I installed Windows 8 on a six-year-old machine recently, the only upgrade it had received in that time was some more RAM). So knowing what you’re buying is still useful, and it lets you compare apples with apples when it comes to prices.

The Current Market

Intel and AMD are still the big boys in the desktop and laptop markets, if you want to run Windows it’ll be on their chips. If you’re looking at a Mac, they’re powered by Intel chips. The current ranges broadly divide as follows:

Manufacturer Low-Power Budget Standard Performance
Intel Atom CeleronPentium i3/i5 i7
AMD C-SeriesE-Series SempronAthlon II A-Series FX

To be honest, I spent a lot of time looking at the various chip ranges and ended up more confused than when I started. The Intel i-series chips seem the easiest to follow, which AMD seems to be replicating with an equivalent A-series (the higher the number the more powerful the processor) but there are still some old chip families kicking around to confuse things. Personally, I’d recommend sticking with the newer i-series and A-series/FX chips from the relevant vendor. I get the feeling the others are likely to be phased out over time and they use different physical sockets which makes upgrading problematic. Each range seems to have an equivalent mobile version, so the same applies to laptops. As a rule, Intel chips are more powerful (at least at the upper end) but more expensive while AMD chips are usually usually offer better value for money. So if you want performance, stick with Intel, if you have a budget, look at AMD. Continue reading…