Apologies for the delay – what I did was basically created a .js file and places it within my theme folder – for example themes/nameoftheme/custom/checkcode.js
Then using jquery – I created my code – here’s a snippet:
jQuery(‘#in-category-6’).click(function(){
jQuery(‘#metabox_one’).toggle(this.checked);
jQuery(‘#metabox_two’).hide();
jQuery(‘#metabox_three’).hide();
jQuery(‘#in-category-3’).attr(‘checked’, this.checked);
jQuery(‘#in-category-1’).attr(‘checked’, false);
jQuery(‘#in-category-4’).attr(‘checked’, false);
jQuery(‘#in-category-5’).attr(‘checked’, false);
jQuery(‘#in-category-7’).attr(‘checked’, false);
jQuery(‘#in-category-8’).attr(‘checked’, false);
jQuery(‘#in-category-9’).attr(‘checked’, false)
});
It seems pretty explanatory but fyi
in-category – refers to the category selected in the category box.
attr – refers to attribute and as it’s a checkbox – hence checked.
when catgeory-6 is selected, the metaboxes defined by the name is either hidden or not.
After this – we now need to call this the javascript file – and this is done by going to the functions.php file of your theme.
here you put –
wp_enqueue_script(‘myscript’, ‘/wp-content/themes/nameoftheme/custom/checkbox.js’);
fyi wp_enqueue_script is the bit that calls the script when the page is loaded.
I hope this is clear for people.