Odd & Even: Alternating Post Classes For Styling

Often a design calls for styling that makes an article archive (or any list of custom post types) easier to visually navigate. This can be as simple as altering the background color of every other post or something more involved depending on the situation at hand, but to do this we need alternating classes for each post in the loop. WordPress doesn’t do this out of the box, but adding this to your theme couldn’t be easier! Read more Odd & Even: Alternating Post Classes For Styling

CSS: Equally Spaced Horizontal Elements

Sometimes there are things you want to do in your layouts with CSS (Cascading Style Sheets) that you assume would be easy, but as you dive into the coding, it turns out what you thought should work just isn’t cutting it. Equally spacing elements across a horizontal area so that the first and last items are flush with the left and right borders respectively turns out to be a perfect example of this. For the lowdown on how to best accomplish this, read on! Read more CSS: Equally Spaced Horizontal Elements

Responsive Aspect Ratios With Pure CSS

One of the hurdles I faced when beginning to work with responsive designs was the lack of an obvious way to assign an aspect ratio to a container in CSS. This kind of thing can be handled with an image placeholder or Javascript, but neither is an elegant solution. Fortunately, with a little bit of digging, an answer soon presented itself! Read more Responsive Aspect Ratios With Pure CSS

WordPress: Take Control of Private Post Titles

WordPress gives us an easy built in way to hide certain posts or pages from non logged-in users, by simply marking the post status as private or password protected. When we do this, the title of the post or page will automatically be prefixed with “Private:” or “Protected:” In some cases this is no big deal, but sometimes we may want to prefix with something different, or nothing at all. Today we’ll see how we can take control of the matter. Read more WordPress: Take Control of Private Post Titles

Youtube Thumbnails Via PHP

Embedding videos from Youtube into a website is a rather painless procedure. Each video is provided with sharing options that include a bit of html code that will get the job done, and with WordPress it’s even easier. All you need is the video URL and the oEmbed protocol included in WordPress will take care of the rest of the embedding for you. These solutions put the video directly into your content, which is fine if you are adding only one or two, but when we’re dealing with many videos to be collected on one page this is far from ideal. In these cases I usually opt to put together a solution using the Fancybox modal window script and a video thumbnail image link. Read more Youtube Thumbnails Via PHP

WordPress: Take Control of HTML Tag Filtering

One of the important ways in which we protect websites from hackers, spammers, and other such baddies is by preventing them from injecting malicious code into our databases. WordPress provides us with some built in security functions that stop this type of thing by automatically stripping certain code tags out of entries to our database and allowing others. On occasion though, we may want some control over what is allowed and not allowed in our entries or comments, and today we’re going to explore just how to do that! Read more WordPress: Take Control of HTML Tag Filtering

PHP: Random Data Retrieval

Sometimes we may want to present our data in an unordered fashion, avoiding alphabetical or date based sorting. For example, creating a “Featured” list of articles that changes upon each page load by choosing a handful at random from our database. Another instance may be wanting to change up an image at random for each page or page load. When dealing with the data in our database with the PHP (Hypertext Preprocessor) programming language, we have several options… Read more PHP: Random Data Retrieval

MySQL: Avoiding Access Denied Errors When Importing DB

Moving MySQL databases from one server to another is usually a pretty painless and relatively easy process when the phpMyAdmin tool is available on the hosting servers. An unforeseen hiccup recently presented itself to me when trying to move a WordPress MySQL database from one account to another on the same ISP. It was a situation I had never run into before as usually a move is from one ISP to another. The solution turned out to be rather simple but not necessarily obvious, so I thought I’d share it here! Read more MySQL: Avoiding Access Denied Errors When Importing DB

WordPress Quick Tip: Using Shortcodes in Templates

A WordPress project I’m currently working on presented me with a situation that I soon realized was calling for a custom WordPress shortcode. In a future post I’ll cover the process of creating a custom shortcode, but for today I’ll share a quick tip on how to use shortcodes in your theme templates as opposed to a post’s content.  Read more WordPress Quick Tip: Using Shortcodes in Templates

WordPress: Tweaks For Good Theme Development – Part 1

WordPress has really made some huge leaps forward in recent versions making it a truly powerful content management system. Not coincidentally, WordPress custom theme design and development has really become a passion of mine… one of the fruits of which is a tried and true collection of customizations and tweaks I always start off with when creating a new custom theme for a client. In this post I’ll share some of them and explain a little about why I think they’re important. Read more WordPress: Tweaks For Good Theme Development – Part 1