Print the current WordPress template
Ever get confused about the template files being used for the different pages within your WordPress site? WordPress supplies a useful Template Hierarchy reference to help determine the template for each page. Maybe you have a terrible memory like me, or you aren’t a regular WordPress developer, or maybe just too lazy the turn your head 30 degrees to the left where you have pinned up the reference next to your computer monitor. Regardless, I personally like to use a small function I created during the initial development phase of a WordPress website. Simply paste the following function...
Read MoreCreating a two-style title
Ever received a design request for a project where a single field of content, for example a title, requires varying colours for one or more of the words? This is similar to the ‘Dropcaps’ style often used in typography to enlarge the first letter of a slab of copy. Today I will run through a solution quickly implemented to obtain a similar result, using a single PHP function and minimal CSS. Part 1. The PHP function Insert the following PHP function in any PHP file used throughout your website. <?php /** * Allows...
Read MoreCharacter-length string trimming
Often I have a requirement to trim strings to fit a specific content area, commonly used to present a summary/teaser/excerpt of an article, page, blog post or similar. Generally the likes of WordPress’ trim_content() function will suffice, but the issue I have with this function is it’s focus on trimming by word length. I find it much more practical to trim by characters. This way the string is a more predicable output length because the variance is generally only the width difference in characters (eg. ‘w’ is a wider character than ‘i’), rather than the...
Read More