Well hello guys 'n' girls! It's been a while since I last posted here hasn't it? There have been a lot of things I've wanted to write about but apathy, procrastination and downright laziness just kept on holding me back. I found myself completely lacking in motivation (for pretty much anything) over the past six weeks or so. I have no idea why the melancholy struck but it hit hard - and it kept me in it's vice-like grip.
Anyway, while I may not have had the inspiration to write, I have been fiddling a little with my CSS and the underlying WordPress installation that keeps this website online. This has resulted in three little tweaks that I'd like to draw your attention to.
I have installed Lester 'GaMerZ' Chan's excellent page navigation plugin, WP-PageNavi. This plugin replaces WordPress' previous and next page links with a more intuitive and useful floating page number grid, similar to that which adorns the hallowed pages of Google's search results.
On this site, the grid enables the reader to quickly access the first and last pages of a set along with the two adjacent pages either side of the current one. It's much more useful than the default WordPress behaviour.
Still on the subject of page navigation, something that'd been bothering me for a while was the way that long next and previous page link titles resulted in a mangled button alignment under the current page design.
I'd chosen to display page titles for my next and previous page links rather than the generic "next" and "previous" as I think it benefits the reader if he/she knows what to expect on clicking the link.
Unfortunately my design for the relevant controls fell apart if the adjacent page titles were longer than 32 characters, as can be seen from the screen capture below.
What I wanted to do was to automatically truncate a title if its length exceeded 32 characters and append an ellipsis to the truncated title to indicate such to the reader.
Unfortunately I was unable to find an API hook in WordPress that would enable me to make this simple adjustment to its logic. So I had no choice but to hack the WordPress source itself.
I made a small change to the file link-template.php which is in the wp-includes directory. The modification begins at line 961 and looks like this before the change:
$title = apply_filters('the_title', $title, $post);
$date = mysql2date(get_option('date_format'), $post->post_date);
Replace the above code with the following to enable automatic truncation of titles:
$title = apply_filters('the_title', $title, $post);
$alt_title = $title;
$hack_length = strlen($title);
if ($hack_length > 32) {
$title = substr($title,0,32);
$title = $title . '…';
}
$date = mysql2date(get_option('date_format'), $post->post_date);
Then replace both instances of "32" to whatever character length suits your design.
This resulted in page links that look much better to me:
Notice the ellipsis indicating the truncated title! I think this is a much neater handling of the title-too-long edge case.
WARNING: If you make this change then please ensure that you take a backup of the link-template.php file before you do so. Also be aware that you will probably have to make this change after every subsequent WordPress update until such time as the WordPress crew provide an option or API to handle this.
In The Sorry State of Browser Rendering I bemoaned not being to easily present copy in a multi-column format (think newspapers). What I didn't realise was that, using the CSS 3 Multi-column layout module, I could! Furthermore, implementation is simple and degradation is graceful for none-supporting browsers. I've added some multi-column CSS to the Urban Mainframe's stylesheets so expect to see some 2 and even 3-column copy making an appearance on here (assuming you're using a supporting browser like Safari or Firefox).
.twoColumns { column-count: 2; column-gap: 20px; -webkit-column-count: 2; -webkit-column-gap: 20px; -moz-column-count: 2; -moz-column-gap: 20px; }
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed consectetur tortor ut metus. Etiam sed nunc vitae nibh volutpat malesuada. Nunc a purus ullamcorper turpis interdum dapibus. Nullam gravida tortor sit amet tortor. Etiam congue, lacus et convallis tincidunt, urna lectus lobortis magna, sed scelerisque nisl orci mattis sem. Sed placerat ultricies tellus. Donec risus mauris, iaculis ac, adipiscing a, scelerisque ut, sem. Nam lectus leo, viverra sit amet, rhoncus ac, dignissim id, elit. Mauris arcu tortor, vulputate vel, ultricies eu, imperdiet nec, leo. Donec dictum magna at risus. Donec et urna at purus posuere blandit. In hac habitasse platea dictumst. Suspendisse eu velit eget libero laoreet tincidunt. Nullam et augue nec felis condimentum ultricies.
In elit urna, luctus vel, rhoncus a, sagittis id, nibh. Nunc bibendum dui sed justo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas quam dolor, aliquam quis, feugiat pharetra, laoreet quis, leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas euismod. Nulla eu urna in purus tristique rhoncus. Praesent urna massa, dictum vitae, sagittis in, consectetur ac, arcu. Vivamus quam elit, pellentesque vel, pellentesque vitae, gravida a, tellus. Vestibulum dui. Curabitur ut arcu a nunc sagittis fermentum. Fusce ipsum neque, sollicitudin in, fringilla bibendum, scelerisque in, lacus.
.threeColumns { column-count: 3; column-gap: 20px; -webkit-column-count: 3; -webkit-column-gap: 20px; -moz-column-count: 3; -moz-column-gap: 20px; }
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed consectetur tortor ut metus. Etiam sed nunc vitae nibh volutpat malesuada. Nunc a purus ullamcorper turpis interdum dapibus. Nullam gravida tortor sit amet tortor. Etiam congue, lacus et convallis tincidunt, urna lectus lobortis magna, sed scelerisque nisl orci mattis sem. Sed placerat ultricies tellus. Donec risus mauris, iaculis ac, adipiscing a, scelerisque ut, sem. Nam lectus leo, viverra sit amet, rhoncus ac, dignissim id, elit. Mauris arcu tortor, vulputate vel, ultricies eu, imperdiet nec, leo. Donec dictum magna at risus. Donec et urna at purus posuere blandit. In hac habitasse platea dictumst. Suspendisse eu velit eget libero laoreet tincidunt. Nullam et augue nec felis condimentum ultricies.
In elit urna, luctus vel, rhoncus a, sagittis id, nibh. Nunc bibendum dui sed justo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas quam dolor, aliquam quis, feugiat pharetra, laoreet quis, leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas euismod. Nulla eu urna in purus tristique rhoncus. Praesent urna massa, dictum vitae, sagittis in, consectetur ac, arcu. Vivamus quam elit, pellentesque vel, pellentesque vitae, gravida a, tellus. Vestibulum dui. Curabitur ut arcu a nunc sagittis fermentum. Fusce ipsum neque, sollicitudin in, fringilla bibendum, scelerisque in, lacus.
Last Revision: May 3rd, 2009 at 19:58
Short URL: http://wp.me/phEOu-lA
I’ve been suffering from a lack of blog inspiration for the past couple of months. I’m posting about twice a week and some of those feel a little forced. I dunno, maybe after you’ve been blogging for a while you run into a period of blogger’s block mixed with lack of enthusiasm. I hope my enthusiasm will return at some point. I did try Twitter for the first time at the weekend and feel a little bit more enthusiastic about that. Posting 140 character junks is a little less pressure than coming up with a blog post
It might be just you and I Kevin. Most of the blogs I read seem to publish daily (sometimes more than once per day). I don’t know where their authors find the time or inspiration to write so much. What bothers me is that I encounter loads of things I’d like to blog about but, more often than not, I just can’t be bothered to write - to actually have to think about a written composition.
I haven’t tried Twitter personally. I might at some point, but for now my aim is to kick this apathy out - and finish some of the half-dozen considered articles I’ve got half written in my “drafts” folder.
Come on Jonathan - get it together!