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

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

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