Rian Rainey Web. Tech. Mobile. Wonk.

9May/12Off

Adding Class Names to Body Tag

This is how you conditionally add classes to the body tag in WordPress.
/**
* Add specific CSS class by filter
*/
add_filter('body_class','my_class_names');
function my_class_names($classes) {
if(!is_front_page()){
$classes[] = 'interior-page';
}
return $classes;
}

Tagged as: , Comments Off
9May/12Off

Code To Add Widget Area to Template

If you want to add a widget area to your template file, this is the code to use:

<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('widget-area-name-defined-in-functionsdotphp') ) : ?>
<?php endif; ?>

Filed under: Wordpress Comments Off
19Apr/12Off

Prevent WordPress from Prompting for FTP Username/Password

Sometimes I have problems uploading plugins to a site if I'm screwed up the ftp users. Usually I define the ftp user and password in wp-config.php but sometimes you need to buy pass it. Here's how I bypass it:

define('FS_METHOD', 'direct');

After this, you also have to make sure you have 777 permissions on the Plugins and Upgrade directories within wp-content.

Filed under: Wordpress Comments Off
18Apr/120

Create New MySQL User and Database

This is how I do it:

grant all permissions on databaseName.* to dbUser@'localhost' identified by 'p@$$w0rd'

Filed under: MySQL No Comments
15Nov/11Off

Dinner at the Augustine’s

20111114-205415.jpg

Filed under: Miscellanous Comments Off