Loading IE Conditional Stylesheets in WordPress

Most web developers are familiar with the standard IE conditional comments that allow you to load a stylesheet only in Internet Explorer.  For example: View the code on Gist. Many new WordPress developers / themers tend to just hardcode these conditional comments directly into their theme’s header.php file.  This approach might work well for one-off … Continue reading Loading IE Conditional Stylesheets in WordPress

Reorder Posts in WordPress Programatically

WordPress uses the menu_order column in the posts table to manage the ordering of pages and hierarchical post types. If you have a situation where you need to display a collection of posts in a particular order, making use of this database column is the way to go. Then whether you are fetching posts with … Continue reading Reorder Posts in WordPress Programatically

WordPress User Login Redirect

WordPress sites that offer personalized or private content typically want to keep their users on the front end of the site.  However, WordPress automatically takes users to the back end dashboard after they login.  Obviously, we need to be able to redirect these users to the front end of the site; but at the same … Continue reading WordPress User Login Redirect

Replace the WordPress Dashboard

When it comes to customizing the WordPress dashboard, you basically have two options: Customize the widgets that appear on the WordPress dashboard by adding and removing them in the code. Completely replace the dashboard with your own custom dashboard. The first option is a great option, but the issue here is that you have no … Continue reading Replace the WordPress Dashboard

The WP_Post Object and Virtual Properties

WordPress 3.5 introduced a lot of changes under the hood. One of the simple things that makes my life much easier is the way that the new WP_Post object allows post meta to be fetched using virtual properties. If you aren’t familiar with classes or virtual properties, all you need to know is that you … Continue reading The WP_Post Object and Virtual Properties

The Euclidean Algorithm in PHP

The Euclidean algorithm is a mathematical formula for efficiently determining the greatest common divisor between two integers. It is great for simplifying fractions. Yep, I can see your eyes glassing over already. If you really want to know more about this algorithm other than my code snippet, just read the about Euclid’s algorithm on Wikipedia. … Continue reading The Euclidean Algorithm in PHP