get_template_directory() vs bloginfo( ‘template_directory’ ) vs TEMPLATEPATH

To make a long story short: get_bloginfo( ‘template_directory’ ) and get_bloginfo( ‘template_url’ ) simply return get_template_directory_uri(). So, you can shortcut that second call simply by referring directly to the latter template tag. Refer to source for get_bloginfo(). A few others: ‘url’ => home_url() ‘wpurl’ => site_url() ‘stylesheet_url’ => get_stylesheet_uri() ‘stylesheet_directory’ => get_stylesheet_directory_uri() ‘locale’ => get_locale() … Read more

Integrate WordPress and bbpress profiles?

Get redirection plugin to redirect the /profile.php to bbpress profile. Then there is a plugin called admin menu editor where you can completely remove the profile the admin menu (and other unwanted admin menu items). Or you can replace the wordpress profile with just email and password wordpress.org/extend/plugins/change-password-e-mail/

Validating Custom Meta Box Values & Required Fields

The easiest way is to add Javascript validation via the jQuery Validate plugin. Here’s the most basic walkthrough: Near your add_meta_box call, enqueue the jQuery Validate plugin as well as a JS file for your simple script: add_action(‘admin_enqueue_scripts’, ‘add_my_js’); function add_my_js(){ wp_enqueue_script(‘my_validate’, ‘path/to/jquery.validate.min.js’, array(‘jquery’)); wp_enqueue_script(‘my_script_js’, ‘path/to/my_script.js’); } Then in my_script.js include the following: jQuery().ready(function() { … Read more

Creating an Image-Centric Custom Post Type?

goldenapple’s initial answer gave me the jumpstart I needed to finish this up. functions.php Here is the complete code I’m using to add a new post type “header-image” and modify other admin screens accordingly: /** * Register the Header Image custom post type. */ function sixohthree_init() { $labels = array( ‘name’ => ‘Header Images’, ‘singular_name’ … Read more

How to *remove* a parent theme page template from a child theme?

Overriding that template would be much easier than getting rid of it. Just the way logic goes. I make no claim it’s efficient idea (late here), but this would get it nuked from edit screen: add_action(‘admin_head-post.php’,’remove_template’); function remove_template() { global $wp_themes; get_themes(); $templates = &$wp_themes[‘Twenty Ten’][‘Template Files’]; $template = trailingslashit( TEMPLATEPATH ).’onecolumn-page.php’; $key = array_search($template, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)