Packaging plugins with themes

As I develop a new theme, I want to package plugins with my theme.  Normally, plugins are installed under wp-content/plugins – but if you are distributing your theme, you need a clean, WordPress-familiar way of distributing the corresponding plugins as well (especially the plugins your theme depends upon). Turns out that Thomas Griffin has created…

Details

Admin bar not showing

I am developing a new theme from scratch.  Came across an issue where the black admin bar (runs along the top of a site for Administrators) was not displaying.  Turned out that I had wp_head() called from within my header.php file, but did not have wp_footer() called from within my footer.php file.  Details and some…

Details

Accessing a WordPress database

Ever see code like this? function my_special_function() { global $wpdb; $wpdb->get_results( “select * from tbl_blah” ); } There’s a special variable that WordPress sets up called $wpdb.  It is a window into the database – something that a programmer familiar with SQL can use to access the tables in a WordPress database.  You can read…

Details

Sizing your online banners

If you are creating banners for your site, you can create whichever shapes/sizes you wish.  But, if you want to put advertisements up supplied by a place like Google’s Adsense, you want to probably follow some sizes that are supported (all listed in pixels and all width x height from Google Adsense as of December…

Details

Using LESS in Eclipse

If you are trying to use LESS files in Eclipse, you will notice that those files are viewed as plain text – no indenting, no color-coding, no outlining, etc.  If you want to fix this up so that these LESS files behave like CSS files, do the following: Install XText (this is a pre-requisite for…

Details

A cool regex tool

Setting up regular expressions in code can sometimes be a pain.  Maybe you want to test that your regex is correct before decorating it to meet your language’s needs.  Well, there is a useful tool that I’ve used that does just that – http://regexpal.com/ RegexPal is a browser-based regular-expression tester.  Type in some sample text, a…

Details

How to perform a regex using PHP

Regular expressions are generally not intuitive. Regular expressions in PHP are especially not intuitive. In short, there are some special rules to writing regular expressions using PHP.  Here are some differences: Delimiters // Traditional – no delimiters necessary .* // PHP – use a pair of slashes (or other non-alpha/numerics) /.*/ Character Classes // Traditional…

Details