Posts tagged as "wordpress"

Customising WordPress Without Modifying Core, Theme Or Plugin Files

A standard WordPress install is incredibly powerful and flexible. For a lot of people, WordPress out of the box plus one of the stock WordPress themes is enough. But the possibilities for customization are endless; you can add plugins and other themes. Sometimes these do just what you want. Sometimes you need to ... tweak WordPress.

A very high proportion of the customization advice you'll find on the web starts with these lines ... add the following to the end of your theme's functions.php or even worse, advises that you modify the source code of your theme or your plugins. This is bad for many reasons:

  • Editing your theme's functions.php makes theme specific customizations; change your theme and your customizations will no longer get loaded.
  • When your theme and plugins get updated you'll find all your careful hand crafted customizations get overwritten and lost.
  • A lot of theme and plugin authors won't offer support for changes you might have made to the source code.
  • Your customizations might work; but you might also inadvertently make some other changes which will stop things working.

WordPress doesn't yet support a way for site specific customizations to be made and loaded without touching theme, plugin or core files; that's why I wrote WP Customizer and that's what this plugin is for. When WordPress does support such a way, this plugin will thankfully be obsolete.

Foursquare Checkins, Maps And WordPress; Now With MOAR Maps

If you're an avid Foursquare user you can already display your last checkin, visualised on a map, in the sidebar of your WordPress powered site with the WP Quadratum plugin. Foursquare, checkins and maps ... what more could you ask for? Maybe the answer is more maps.

Version 1.1 of the WP Quadratum plugin, which went live this morning, now has added maps. The previous versions of the plugin used Nokia's maps, because I work for Nokia's Location & Commerce group and I wanted to use the maps that I work on. But if Nokia's maps aren't the maps for you then how about Google's, or maybe CloudMade's OpenStreetMap maps or perhaps OpenLayers' OpenStreetMap maps.

Tracking Down Use Of Deprecated WordPress Functions Or Arguments

If you've been running your blog or site on WordPress for any period of time, you may well have come across a message about a deprecated function or argument in your PHP log file or across the top of a page on your site. The message might look something like this ...

Notice:  get_bloginfo was called with an argument that is **deprecated** since version 2.2! The siteurl option is deprecated for the family of bloginfo() functions. Use the url option instead. in /var/web/htdocs/site/wp-includes/functions.php on line 2712

... this often appears after you've installed or upgraded a new theme or plugin. This message is helpful but really only 50% useful. The PHP file and line number that's being reported isn't where the deprecated function or argument is being used; it's where it's being reported from. Often, even after you've searched through the source code of the new plugin or theme you're still none the wiser about where the troublesome piece of PHP that WordPress is telling you about actually lives. WordPress is a complicated mix of PHP, JavaScript and CSS; there's a lot more going on under the hood than most of us are remotely aware of.

Of CSS, Pointers, Archive Pages and Meta Boxes; WP Biographia Reaches v3.2

WP Biographia v3.2 got pushed to the WordPress plugin repository this afternoon. In the grand scheme of things it's not a massive release but it goes a long way to solving some of the most frequently asked questions that arrive in my Inbox and via the plugin's support forums.

As I've mentioned a few times in the past, it's nigh on impossible to test a WordPress plugin against the myriad combinations of themes and plugins that exist in the WordPress ecosystem. Especially where CSS is concerned, plugins and themes frequently don't play well together and bleed over from another theme or plugin's CSS often makes WP Biographia's formatting look ... interesting. This tends to happen in two places. Firstly in the formatting of the contact links in the Biography Box and secondly in the positioning of the user's avatar image.

Wp Biographia v3.2 provides two workarounds for this. The plugin's CSS now uses the !important CSS specifier to ensure the CSS is applied as it should be in as many cases as is possible.

But sometimes this isn't enough to fix formatting issues, especially if the plugin's the_content filter priority has been dropped below the default value of 10, to get the Biography Box to appear in the right order with the output of other plugins. In this case, the WordPress wpautop filter, which automagically adds paragraph tags, runs after the Biography Box is produced. In this situation you can now tell the plugin to synchronise the wpautop filter to run after the Biography Box is produced.

Don't Go There, Go Here; A WordPress Redirection Plugin

Despite having written 5 plugins for WordPress I've only just scratched the surface of what it's possible to make WordPress do. So when I want to make WordPress do something that I'm not sure a) how to do and b) whether it's even possible or not, I turn to a search engine. More often than not I get an answer. Often that answer seems to start along the lines of

put the following code in your theme's functions.php file

Converting Markdown To HTML; In Any Mac Text Editor (With A Little Help From Automator)

There must be a truism somewhere out on the interwebs that goes something like this ...

if a computer geek finds himself or herself doing a task repeatedly, he or she will invariably find a way to automate this task

... and if there isn't a truism to this effect, then I've just written it for the first time.

In this particular case, the repetitive task was converting text written using John Gruber's Markdown syntax into HTML. Those of you who know Markdown will be asking the question "but Markdown is already a text-to-HTML conversion tool, why would you want to do this?". They'd be right too, so an explanation is due.

Bending WP Biographia To Your Will; A Configuration Guide

WP Biographia has grown and matured quite a bit since it was first released. A quick glance through the multiple releases of the code that make up the plugin tells me that in v1.0, the plugin was 761 lines of PHP code and 46 lines of CSS. Now in v3.1, that's increased to 2944 lines of PHP, 92 lines of JavaScript and 174 lines of CSS.

But more importantly, as the plugin has grown and changed and more and more features have been added, so have the number of configuration settings, from 22 in v1.0 to 43 in v3.1. While most people seem to use the plugin out of the box, with little or no customisation, if you do want to take full advantage of all that the plugin has to offer, this means you need to roll up your sleeves and trawl through all of the plugin's settings, which can be a daunting task at times.

So with this in mind, assuming you've installed and activated the plugin, here's a step by step and screen by screen guide to bending WP Biographia to your will.

WordPress Shortcodes; Documenting The Undocumentable

WordPress shortcodes. A great idea. Small snippets of text with a special meaning, enclosed in left and right angle brackets. Put one of these in a WordPress post or page and WordPress automagically expands the shortcode and replaces it with the thing that the shortcode does.

WordPress has a built-in set of shortcodes and many plugins add to this repertoire, adding one or more of their own shortcodes. But here's the problem. Shortcodes are meant to be expanded and in 99.999% of cases, that's just what you want to do. But what happens if you're one of those 0.001%; you've written a plugin that adds a shortcode and you want to document it. You can't just write the shortcode in a post as WordPress will go ahead and expand it for you.

You could take the time and effort to replace the [ and ] characters which surround a shortcode, writing something like [shortcode], which is exactly what I've been doing since I released the first version of WP Biographia. But this is a long and laborious process. Frankly, it's boring and a pain in the backside.

Two WordPress Plugins And The (Missing) Nokia Map

It's a glaringly obvious oversight but a few month's back I realised that given what I do for a living, there's something missing from my blog and that something is a map.

There's a whole slew of "where am I" style WordPress plugins out there, but after some careful research I decided that none of them did precisely what I wanted, which was to show the last check-in I made on Foursquare, on a map, in the sidebar of my blog.

Those that did come close still didn't do the key thing I wanted and that was to use the map I work on as part of my day job. Now don't get me wrong, I've got nothing against the maps that I could have used; Google, Bing, Mapquest and OpenStreetMap produce very fine maps and they all have the JavaScript API I'd need to display my last checkin. But none of them used my map and that means a Nokia Map.

Finally WP Biographia v3.0 Makes It Off Of The Starting Blocks

It's taken a while but I just did this ...

$ rsync --recursive --verbose --exclude '.git' \* ~/Projects/svn/wp-biographia/trunk/
$ svn up
$ svn stat
$ svn ci -m 'Updating with v3.0 changes from master on github'
$ svn cp trunk tags/3.0
$ svn ci -m 'Tagging v3.0'

... and after much coding, rewriting, testing and documenting, v3.0 of WP Biographia has finally made it off of the starting blocks.