Posts tagged as "code"

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.

Of Robots And Teapots; Web Geeks Are Not Without A Sense Of Humour

There's a line from the first Matrix movie, the only really good one out of the trilogy, where Morpheus says earnestly to Neo ... fate, it seems, is not without a sense of irony. It's time to add a corollary to this quote, along the lines of web geeks, it seems, are not without a sense of humour.

Last year, it was the web geeks who run the web servers for Yelp and Last.fm sticking Asimov's Three Laws of Robotics into their respective site's robots.txt file. Sadly, it looks like Yelp's robots.txt is now unfunny and businesslike, but Last.fm's subversion of this file is still there.

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.

Asking For WordPress Plugin Help And Support Without Tears

When you release some code you've written under one of the many open source licenses that exist today, if you're lucky then you can expect to get asked for help using that code. Note that I say if you're lucky. Some people I know view giving help and support as, frankly, a pain; it gets in the way and stops them thinking about a new feature or the next big thing. I take the opposite view though, I see being asked for help as a compliment; it means someone has found the code I've written and actually thinks it might, maybe, be useful, so they're using it and need a bit of support in getting it to do what they want it to do.

So if getting asked questions about code I've written isn't a problem for me, then why am I writing this? It's not the being asked as much as it is what is being asked. Support questions such as ...

WP Biographia Hits v2.1.1 In Time For Christmas

WP Biographia's always had the ability to suppress the display of the plugin's Biography Box for all users; unfortunately that's been accomplished by simply not installing the plugin. But judging from requests on the WordPress forums as well as emails hitting my Inbox, suppressing the display of the Biography Box for some users ranks highest on the list of requested features.

So it's good to be able to say that as of v2.1.1 of the plugin, you can now do this and v2.1.1 is now live and able to be downloaded from GitHub as well as from within WordPress or via the WordPress plugin repository.

Beta No More; WP Biographia Hits Version 2.0

It's taken a while but after 20 commits on GitHub, 1000 odd lines of PHP code, 40 odd WordPress forum posts and, what to me is a staggering, 1100 odd WordPress downloads, WP Biographia finally hits version 2.0. As I've written before, this is very much an ongoing learning process and putting version 2.0 out into the wild hasn't been entirely trouble free, as this thread on the WordPress forums amply shows.

But despite the initial teething problems, version 2.0 is out and the list of enhancements and fixes remains unchanged from the beta version, but the official version 2.0 release of this plugin is now both on GitHub and the WordPress plugin repository and while my Codeage page still remains the official home for this plugin, there's a nicer looking home on GitHub for WP Biographia courtesy of GitHub's pages feature.