Skip to content

Instantly share code, notes, and snippets.

@ivandoric
Created April 23, 2014 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivandoric/11214990 to your computer and use it in GitHub Desktop.
Save ivandoric/11214990 to your computer and use it in GitHub Desktop.
wordpress: Select subcategory in wordpress
add_action( 'admin_print_footer_scripts', 'selektirajPodkategorije' );
function selektirajPodkategorije(){ ?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#categorychecklist").find("input:checkbox").click(function() {
var koji = jQuery(this).parent().parent().parent().attr("id");
if(koji == "categorychecklist") {
var check = jQuery(this).prop("checked");
jQuery(this).parent().parent().find(".children").find("input:checkbox").prop("checked", check);
}
});
});
</script>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment