Custom Page Labels is a no frills WordPress plugin that allows you to add a custom label (identifier) to a page making it is easier to quickly identify a page on the all pages screen.
Not all page titles are as simple or as identifiable as “About Us” or “Home Page”. More often they’re carefully crafted and even a bit lengthy. For example, about us becomes “Our Amazing Widget Company Employs Only the Best and the Brightest.”
Let’s say we have a list of downloadable items listed on a post or page, case studies for example. To help the end user understand what they will be downloading we’d like to display a file type adjacent to a download link.
e.g. Click to Download | PDF
Background: In this particular example our Case Studies are going to be a custom post type and the file attachments (downloads) are going to be added to each individual custom post type using custom fields. These custom fields are generated using the excellent Custom Metaboxes and Fields for WordPress.
This bit of information is important because by using Custom Metaboxes and Fields we are able to easily retrieve the attachment ID, which is what we really need to make this work. (see this example)
So, keep that in mind, the following can be used as long as you have that attachment ID.
Explanation: The above assumes that we’re in a loop of some sort and have already retrieved our attachment id, e.g.
$file_id = get_post_meta( get_the_ID(), '_my_download_id', 1).
Then we use wp_get_attachment_url( $file_id ); to get the url for our attachment. We need this to generate the actual download link but we also want to save it as a variable so that we can use it in the wp_check_filetype( $file_url ) function. wp_check_filetype() returns an array of values containing the extension and mime type.
We then use the $filetype variable to output the extension with
I might expand on this a bit more in the future to explain in detail how this was used but there should be enough there to be potentially useful.
Problem: In a recent WordPress project we needed to provide an easy way for the site manager to locate the numerical ID associated with a custom taxonomy.
As WordPress developers we have a handful of methods at our disposal to recover that ID but those options are not always that easy to explain to our clients.
So let’s make it easier.
In a recent custom WordPress build I needed to add microdata to all images output by the_post_thumbnail inside of a custom template and where a catch all function did not make sense.
Specifically I needed to add itemtype=”photo” to thumbnail images associated with a “Place” in a custom place listings template but these are implementation specific details that will vary based on your needs.
No literally, find me… from now on I’ll link to the Facebook home page, you take it from there. Deal?
Because hey, that’s what it sounds like you want me to do.
Three and a half years ago, give or take six months I released my first freely available WordPress theme. Being a bit less than confident at the time I never pushed it to the theme repository on WordPress.org but it managed to get a bit of attention with somewhere around 8000 downloads to date. It’s still available at http://papertreedesign.com/themes but as the notice clearly states, it’s not been updated for at least a year.
Well… I’m making an effort to change that. I just downloaded a fresh copy, opened it up in Coda and plan to get to work immediately. It’s going to be a major update and will most certainly take a bit of time, a lot of things have changed since including the way I code. That said, I plan to push it to GitHub as soon as I’ve got something solid so if you’re interested you can always follow along there.
Last but not least, if you’re interested in adding your two cents or have suggestions, feel free to drop a comment below. As I mentioned above, it is still available for download so go ahead grab a copy or just view the demo and let me know what you think.
(Oh and no need to comment on the code needing to be stripped, reformatted and brought up to date – that’s already #1 on the list.)