Witty and insightful observations on the world? Sorry to disappoint, this is a techie blog purely for self reference - published online in the hope it will help others!

WordPress under Magento multistore

This is a 'Note to Self' as much as anything else. It's explains how we got the Wordpress install to work on a Magento multistore using country stub directories. The SO question it relates to is here; http://stackoverflow.com/questions/32613815/htaccess-wordpress-under-magento-site-with-multi-language-sub-directories We have this in production, hopefully this answer might help someone at some point. The way we've done this is to add a RUN_CODE environmental variable which is used in a custom Wordpress filter to get the urls all working. I've used the 'eu' example from my question to illustrate it below. Note we had to do this for both Apache and Nginx so I've added the .htaccess and server blocks for both. APACHE - .htaccess In the `eu` country stub subdirectory you add this ... Read more

WordPress, Git and Capistrano v3

I'm writing this blog post because I've had to add a Wordpress site into a Magento site which uses Capistrano 3 as it's deployment framework. I was trying to work out the best way to set it all up and Googling it resulted in a right load of shit. No disrespect to the authors (many of whom are clearly very talented) but a lot of it was; - Old, out of date - Overly complicated - Using Capistrano v2 - Fundamentally disagrees with how I think it should be done Let me look at that last point. There are a lot of people who think Wordpress core should be in your repo. I don't agree with this at all, ... Read more

Sagepay – Magento – Armed Forces – INVALID. 3139 : The DeliveryState format is invalid.

The title says it all. Magento installation with failed transactions using Sagepay fail when the delivery address is Armed Forces Middle East, Armed Forces Africa or Armed Forces Canada. It's for a good reason - Magento itself sets the region ID for these options as 'AM', 'AF' and 'AC' respectively; Which is dandy until you realise that these region codes don't actually exist anywhere. As you can see from this instructional on stamps.com, Middle east and Africa should be designated as 'AE' whilst Canada is part of America and should be designated 'AA'; This is all fine when your payment ... Read more

TimThumb.php – 500 Internal Server Error

I haven't been using TimThumb for my dynamic image resizing and cropping for a while now. There is a good script by the guy called Syamil who runs Aqua Graphite that uses the Wordpress built in functions -> you can see it here; http://themeforest.net/forums/thread/aqua-resizer-resize-wordpress-images-on-the-fly/64990 I've seen it incorporated into a few commercial Wordpress themes. There's also this one by Matthew Ruddy which I really like; http://matthewruddy.github.com/Wordpress-Timthumb-alternative/ These methods are great - you can say good bye to the description in a metabox or your docs saying 'use an image XXpx wide and YYpx high' to the client (who probably doesn't have a clue how to resize and optimise images using ... Read more

CSS Transitions on BBC Style Scroller

Seems like ages since I did a blog post so I'm going to ease myself into it gently with a quick one about CSS and a slider. So I am building a custom Wordpress site at the moment on behalf of The Loft up in Glasgow for a financial services company. I won't say who at the moment but I'll come back and Add a link when it's done. There is going to be an HTML5 animated splash page a bit like the Apple one that they did when they won the rights to sell the Beatles back catalogue on iTunes. It will also have a BBC style homepage slider that couples some aspects of the Goldman Sachs slider ... Read more

jScrollable Custom scroll bars

I'm working on a nice little Wordpress job today. The designs are great, but the designer hasn't really catered for variable content heights (it's a list of items driven from a post category, each one has a little drop down box which displays the full post content). Something I see quite a lot to be honest, the designer uses the same piece of Lorem Ipsum for each section - that's fine but it's a CMS and the client is going to be sticking in all kinds of different content which will need to be catered for. We are left with the following list of options; The client has to create content which is exactly the same length as the ... Read more

jQuery UI in WordPress

I normally just dismiss the Wordpress 'Welcome' screen and disable it in the Screen Options menu for the Dashboard. However, I realised this wasn't actually very sensible for a pro Wordpress developer as it shows you what's new and what you should be aware of. As it turns out I noticed on this feed that they now ship the jQuery UI library with the Wordpress core, so you can enqueue it and use it straight from your functions.php file. Simple, eh? Well not really to be honest, mainly because it's not that obvious how to do it (or at least it wasn't tonight, on 05/06/2012). Seasoned users of jQuery UI will know you can build your own ... Read more

Custom Metabox for Specific Category

There are various ways of handling metaboxes and post category types in Wordpress. If time allows it's often better for the clients if you can create custom post types for specific categories and then add in meta boxes specific for those post types. Occasionally that can feel a bit heavyweight, depending on the application. A quicker and easier way to do it is to create a normal post category and then display your metabox only if the user checks that category in their post edit screen. We do this using Javascript, the essence of it being that technically speaking the metabox is created and sitting there all the time, it's only displayed if the user checks the appropriate ... Read more

Pinterest WordPress RSS Widget in IE7

This is one of those painful IE7 tribulations (how much has Microsoft cost developers over the years with their awful browsers? - Answers on a postcard). Plugged it in and all working, then I realise during testing at the end that the thumbs are not being properly hidden in IE, despite the overflow on the parent div being set to hidden and the width and height specified inline via the Javascript. Teary hairy for about and an hour and a half trying everything, Les Aubery at Big Bang sorted it in about two minutes. The parent div might have had it's overflow set to hidden, but the CSS wasn't using it because the image itself had ... Read more

Exclude Posts from Search Results

I thought I'd stick a post together for this, but to be honest I'm tempted to really call it 'Exclude Posts from Search Results - A Classic Example of Excessive Plugin Use'. There can be good reasons why you'd want to exclude certain post categories from the search results in Wordpress - the trouble is that if you Google it you end up looking through the plugin repository and you might end up installing one of them.  I was looking at one just now.  Don't get me wrong, I have the greatest of respect for anyone who writes a plugin and uploads it for general use, keeps it updated, supports users in the forums.  Hats off to them, it can be a ... Read more