New Premium Plugin Available

Easy Custom CSS Stylesheets

I’ve been working on a new plugin for the past week or two, writing documentation for it, and testing it quite extensively. It finally got accepted on CodeCanyon, a marketplace for premium plugins and code.

My plugin is called Easy Custom CSS Stylesheets, and it allows you to create unlimited stylesheets which are stored in the database and link them to your site, or attach them to specific pages, posts, or special pages (Category page, home page, login page, etc). This eliminates the need of modifying your theme source which breaks the ability to update the theme and is generally a hassle.

I plan on adding the ability to do the same thing with JavaScript to the plugin soon as well. The plugin includes a JavaScript based code editor, complete with syntax highlighting, key binds and line numbers. You can even link to remote stylesheets, useful for importing fonts from Google Web Fonts or Typekit.

You can purchase it for $14 over at CodeCanyon.

Share users amongst two WordPress sites

If you have two WordPress sites and would like to share users among them, it’s quite easy. Both sites will unfortunately have to use the same database, with different table prefixes (Please note: This can cause issues with poorly written plugins that don’t use the WordPress prefix option).

On your first site, in the wp-config.php file, you’d set the table prefix like this:

$table_prefix = 'main_'; 

On your second site, in the wp-config.php file, you’d set the table prefix like this:

$table_prefix = 'other_'; 

Then, in your second site, you’d also add this line to the wp-config.php file, towards the top:


Your second site will now use the same users table as your first site. Some other people will recommend adding the line define(CUSTOM_USER_META_TABLE,'main_usermeta');, but this will cause issues with permissions and privileges.

I am currently working on a plugin that will allow you to share user meta such as roles between sites as well, without modifying the core WordPress code. The problem that currently exists is that user roles are stored with a meta key that looks like this:


And I’m having trouble finding a handy filter for changing this. Check back later for my solution (Probably as a plugin or a code snippet for your functions.php file.

New version of WPAC out

I just updated one of my more popular plugins, WordPress Access Control. The newest version, 3.0, includes an admin options interface for setting various default values and behaviours. I’ve also added compatibility for posts and custom post types (Directly from the admin interface), and fixed issues with searching. You can now decide to not show members only pages in search results, show only a title with a custom message instead of an excerpt, or show the title and excerpt but require a login for the full article.

In addition to the above changes I added two shortcodes, and for restricting specific content on a page to either members or non-members. Enjoy!

WordPress 3.1

WordPress 3.1 Beta 1 was just released and I’m already running it on one of my sites. It’s fantastic, they fixed and added quite a few nice things

  • We have the ability to query multiple taxonomies now
  • Custom post types can have archive/index pages (Using the template post-type-archive-{$post_type}.php)
  • The link dialog box lets you search all post types for the item you wish to link to (Finally)
  • The admin has markup has been cleaned up and more AJAX added (Sortable columns, woot)
  • There is an admin bar on the front-end of the site like (They beat me to it, I was actually working on it)

I’m quite excited for the final release, but all seems to be working well so far.

In other news, Gravity Forms 1.5 is coming out soon. I’m a huge fan of Gravity Forms and use it on all of my sites now. 1.5 adds some nice features like multi-page forms and the ability to integrate with PayPal in some awesome ways. For those of you who haven’t heard of it, go check out Gravity Forms now, it blows away every other form plugin for WordPress. It’s SUPER easy to use, so much so that clients can create complex forms with no training. It logs entries to the WordPress admin, lets you set up complex notifications, and much more. It’s definitely worth the $40 for a single license or the $200 for a developer/unlimited license.

Thesis 2.0 is building up a lot of hype but still isn’t out yet, although Thesis 1.6 is doing what I need it to for now.

Google Chrome Dev Channel (9.0) is faster than ever and supports several new features such as the HTML voice input type. The upgrade brings Linux Chrome more inline with the versions available for Windows and Mac (Standard Icon and it’s called Google Chrome not Chromium Browser). Check it out today.

Easy WordPress Theme Options

For the most up-to-date information visit the plugin page

I’ve been getting really annoyed every time I want to add options to my theme and I have to copy a huge mess of code that just isn’t fun to use. You know what I mean. Most theme developers now include configurable options in their themes, which if you ask me, isn’t super easy.

So the other day I set out to write a class that theme developers could package with their file and have easy access to theme options. It’s as easy as adding my theme_options.php file to an include folder in your theme directory, and then adding this code to your functions.php (Using your option values obviously).

Download my ThemeOptions class

require_once( 'includes/theme_options.php' );

define( 'THEME_NAME' , 'Theme Template' );
define( 'THEME_SHORTNAME' , 'themetpl' );

ThemeOptions::add( 'sample_text_field', 'Its a text field'  , array( 'desc' => 'A description of the theme option', 'type' => 'text', 'default' => 'Default Value' ) );
ThemeOptions::add( 'sample_textarea'  , 'Its a text area'   , array( 'desc' => 'A description of the theme option', 'type' => 'textarea', 'default' => "Text\nTest" ) );
ThemeOptions::add( 'sample_checkbox'  , 'Its a checkbox'    , array( 'desc' => 'A description of the theme option', 'type' => 'checkbox', 'default' => 'enabled' ) );
ThemeOptions::add( 'sample_select'    , 'Its a select thing', array( 'desc' => 'A description of the theme option', 'type' => 'select', 'default' => 'Option 2', 'values' => array( 'Option 1', 'Option 2', 'Option 3' ) ) );
ThemeOptions::add( 'sample_radio1'    , 'Its a radio field' , array( 'desc' => 'A description of the theme option', 'type' => 'radio', 'default' => 'val1', 'values' => array( 'val1' => 'Text 1' , 'val2' => 'Text 2' ) ) );
ThemeOptions::add( 'sample_radio2'    , 'Its a radio field' , array( 'desc' => 'A description of the theme option', 'type' => 'radio', 'default' => 'val2', 'values' => array( 'val1' => 'Text 1' , 'val2' => 'Text 2' ) ) );

Now this may seem confusing at first, but if we expand it out, you’ll see it’s similar to other WordPress functions (I did the code like that for that specific reason):

$args = array(
    'desc' => 'This is a description of the option',
    'type' => 'text',
    'default' => 'This is the default value'

ThemeOptions::add( 'option_id', 'Option Name', $args );

And to get a value:

$val = ThemeOptions::get('simple_text_field');

Isn’t that easier that what you’ve been doing? I’ve encapsulated my code into a nice class to make everything super simple. The results should look similar to this (Located in Appearance > Theme Options):

Screenshot of the Theme Options Page

Download my ThemeOptions class