Writings on 'Design'
JavaScript: how to select the first word(s) in a sentence
Recently I had to figure out a way to select the first 2 words in a sentence using JavaScript. I wanted to wrap them in a class so that I could give them some additional CSS styling. I figured it’d be mad easy, but it took a little bit of head scratching until I figured out at least one way to do it.
I’ve got an HTML element with an ID of ‘niceText’ that I’m looking to grab. I’ll save the …
How to split your WordPress posts into two columns
The other day, whilst merrily making a website for an ensemble called Tesserae, I needed to figure out how to display my posts in 2 columns, side by side. In this case, the posts were a custom post type biographies that I used to display the various members biographies on the site.
It wasn’t hard to do, here’s the code I used to display half of the posts:
<?php // Get the number of posts in the custom post type ‘biographies’
$count = wp_count_posts( …
jQuery mobile events firing multiple times and what to do about it
I’m currently working on my very first iPhone app. I decided I’d build it in HTML5, CSS3, JavaScript and wrap it up all cosy and warm with the amazing PhoneGap. I also decided early on to use jQuery mobile as my framework for the project, because I’m so familiar with jQuery itself. It’s been quite a ride so far and I’ve learnt a LOT!
I soon found out that dynamic content and jQuery mobile is not the easiest of pairings, but I …
A suggested fix for the dreaded FOUT
As a keen typography fan I tend to rely heavily on the use of web fonts for my sites. I generally use Typekit to deliver my fonts, but it does tend to take a little while for the browser to download and display my beautiful fonts.
I noticed that if I simply place the typkit required script tags in the header of my site, it will block my site from loading until the font(s) have been downloaded, leaving visitors with a blank …
Easy PayPal Custom Fields Plugin
I’ve just my first WordPress plugin that uses custom fields to make creating a PayPal button super-easy.
I wanted to learn more about PHP and the inner workings of WordPress and I also needed a solution for my clients to add PayPal functionality to their sites without having to remember complicated shortcode syntax. Whilst shortcodes in WP are a fantastic feature and are easy to implement for the developer, I find they can often confuse my clients who often can’t even …
WordPress 3.0 custom queries, post types and taxonomies
There’s been a few really great articles recently published about the new custom posts features in the WordPress 3 Beta, most notably Justin Tadlock’s excellent article and an equally enlightening post on wpengineer.com. I’ve had some fun experimenting a little with the new possibilities opened up to me with this new functionality but I very quickly came up with a problem that took quite a bit of head scratching to solve, namely how to filter my query to a custom …
website 3.0
I’m delighted to welcome you to the third version of richardsweeney.com!
The typography is based on a few 17th century books that are important sources for my work with historical performance and that have kept me good musical company over the years. John Dowland’s ‘varietie of lvte lessons’ (published 1610) was of particular interest to me, the typography is beautiful, not to mention the music!
I had been planning to start writing a blog for a while now and having worked a …
Callino Quartet Website redesign
I’ve just launched my redesign of the Callino Quartet’s website!
The original site was not in any way ugly, but it was a pain for the quartet to keep updated and looked a little dated. The code was butt-ugly and needed a complete overhaul. I used WordPress as a CMS (Content Management System) for the site and rewrote the code using standards compliant xHTML & CSS (with the exception of a few CSS3 additions) plus a little PHP and a dash …
Latest Tweets
Recent Writings
On Music:
Obbligato bass instruments in 17th century Italian instrumental chamber music
On Design:
JavaScript: how to select the first word(s) in a sentence