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

Show Custom Fields in Quick Edit

After adding our custom column, we are ready to expand our Post Quick Edit menu using the quick_edit_custom_box action hook. Note – The quick_edit_custom_box action hook will not fire unless there are custom columns present. That is why we started by adding a custom column. add_action(‘quick_edit_custom_box’, ‘shiba_add_quick_edit’, 10, 2); function shiba_add_quick_edit($column_name, $post_type) { if ($column_name … Read more

Most efficient way to add javascript file to specific post and/or pages?

I think the best balance between efficiency, and using proper wordpress methods for adding javascript would be adding something along these lines to your themes functions.php file. For Example: functions.php: function load_scripts() { global $post; if( is_page() || is_single() ) { switch($post->post_name) // post_name is the post slug which is more consistent for matching to … Read more

How to Add Custom Fields to a Custom Post Type?

This is probably more complicated than you think, I would look into using a framework: http://wpgear.org/#meta-fields If you want to write your own , here are some decent tutorials: http://net.tutsplus.com/tutorials/wordpress/creating-custom-fields-for-attachments-in-wordpress/ http://sltaylor.co.uk/blog/control-your-own-wordpress-custom-fields/ http://thinkvitamin.com/code/create-your-first-wordpress-custom-post-type/

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