Changing Top Level Items into Radio Buttons in the Categories Meta Box?

I’m pretty sure you could use JavaScript to do this for you very simply. I’d try this out: function convert_root_cats_to_radio() { global $post_type; if ( ‘post’ != $post_type ) return; ?> <script type=”text/javascript”> jQuery(“#categorychecklist>li>label input”).each(function(){ this.type=”radio”; }); </script> <?php } add_action( ‘admin_footer-post.php’, ‘convert_root_cats_to_radio’ ); add_action( ‘admin_footer-post-new.php’, ‘convert_root_cats_to_radio’ ); What this does is loops through the … Read more

WordPress: Sortable Metabox Fields Not Saving Position

Normally it should be enough to simply enqueue the postsbox script on a page where you want to have sortable meta boxes. Simply do the following: add_action( ‘admin_enqueue_scripts’, ‘wpse112022_postbox_enqueue’ ); function wpse112022_postbox_enqueue( $hook_suffix ) { // uncomment the next line to see what the $hook_suffix of your desired page is # var_dump( $hook_suffix ); if … Read more

Arrange custom fields with drag and drop?

In this example of repeatable custom fields, we can see that the following jQuery is needed: $(‘#repeatable-fieldset-one tbody’).sortable({ opacity: 0.6, revert: true, cursor: ‘move’, handle: ‘.sort’ }); And the HTML it controls is (simplified): <table id=”repeatable-fieldset-one” width=”100%”> <thead> <tr> <th width=”2%”></th> <th width=”30%”>Name</th> <th width=”60%”>URL</th> <th width=”2%”></th> </tr> </thead> <tbody> <?php if ( $repeatable_fields ) … Read more

Adding upload button in metabox

this is how I do to create upload button in metabox: FILE: template_dir/functions.php add this lines: wp_enqueue_script(‘custom-js’, get_template_directory_uri().’/js/custom-js.js’); // Add the Meta Box function add_custom_meta_box() { add_meta_box( ‘custom_meta_box’, // $id ‘Custom Meta Box’, // $title ‘show_custom_meta_box’, // $callback ‘post’, // $page ‘normal’, // $context ‘high’); // $priority } add_action(‘add_meta_boxes’, ‘add_custom_meta_box’); // Field Array $prefix = … Read more

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