1. Skip to Navigation
  2. Skip to Content
our blog

Archive for Web Development Category

How to Add Custom Fields to Media in WordPress

Sometimes a WordPress project calls for custom fields on Media. We recently built a custom gallery widget that involved uploading multiple images that would have a caption, a heading, the ability to selectively output the image, and the ability to set the hex code color of the text that was output.

To achieve this, I created a custom field on images that would allow you to input a value to be used as the color for the text and a custom checkbox to indicate to output the image.

There are two steps to this:

  1. Add the custom field to the edit screen,
  2. Process that field when saving / updating the media item.

(more…)

WordPress: How to Exclude Categories From the Archive Widget

Updated: 5/2/2012

We love developing in WordPress. For many of our clients, there is no need to reinvent the wheel and WordPress can be a significant time saver.

WordPress is a very thoroughly developed platform – yet every now and again we bump into desired functionality that isn’t readily available, such as excluding categories from the Archive Widget.

Recently, I developed some code to do just that and thought I would share it.
(more…)

Display Recent Spotify Track with Album Cover using PHP

Many of our clients show their personalities on their websites – from Facebook to Twitter feeds, photo streams and more, they like to integrate a bit of themselves. While hooking up a Social Media feed is no problem, recently we had a unique request to develop a widget that displays the most recently listened to Spotify track with artist information and album cover.

It turns out there isn’t a straightforward way to do this; after a little digging around on the internet, and the help of the Spotify API, we were able to put together a solution that I wanted to share.

There are several steps to this process:

  1. Create a Lastfm account and setup Spotify to scrobble to Last.fm
  2. Pull the Lastfm Recent Tracks RSS feed
  3. Look-up the desired Track using the Spotify Metadata API and load the data

(more…)

WordPress: Only Show Authors Their Own Posts and Media in the Admin Area

Updated: 5/13/2012

I’ve helped our clients set up a lot of membership sites; one common request is that members are able to submit articles within WordPress.

Out-of-the-box WordPress can get you pretty far but commonly I run into two roadblocks with the default roles:

  1. The Contributor role doesn’t let Contributors see the Media Library
  2. The Author role lets Authors see everyone’s Media & Posts

While more often than not a plugin is the way to go for a full-on membership site, there’s a really quick fix that will let you assign users to the Author role and be able to hide other’s Media & Posts from them.
(more…)

How To Add A Lightbox To A WordPress Gallery

Updated: 2/29/12

I wanted to setup a simple lightbox photo gallery on a WordPress site (v3.2.1, tested and working on 3.3.1) and, to avoid installing a slew of plugins, I put together a little gallery shortcode function using the built-in WordPress gallery shortcode as my starting point. I’m a big fan of PrettyPhoto, so I modified the output of the gallery shortcode to include a rel= attribute for PrettyPhoto galleries. (more…)

WordPress: How To Change Comment Excerpt Length

I recently needed to output a list of comments and bumped into a little trouble trying to output the comment excerpt. Usually I would use the built-in comment_excerpt() function but I only needed 10 words instead of the 20 that is hard-coded. I put together a little function that I found helpful and thought I would share.

(more…)