Support » Plugins » I moved a meta_box in the admin via jQuery but now it won’t open

  • Resolved Glenn Ansley

    (@blepoxp)


    Hi,
    I placed the following code in the admin header via admin_head action so that I could move some divs around. In the code below, I moved the excerpt div, but the goal is to move a custom box added via the add_meta_box action.

    Anyway, it relocates fine, but the open/close functionality no longer works. I was wondering if anyone could help me figure out why it breaks and if it would work for me to just recreate the effect somehow. Thanks!

    The following code will move the post excerpt box above the tags box in the write post screen if called via add_action(‘admin_head’,’yourfunction’).

    <script type="text/javascript">
    			jQuery(document).ready(function(){
    					jQuery("#postexcerpt").addClass("wptemplate");
    					jQuery("#tagsdiv").before(jQuery("#postexcerpt").clone().removeClass("wptemplate"));
    					jQuery(".wptemplate").remove();
    			})
    		</script>
Viewing 2 replies - 1 through 2 (of 2 total)
  • I added the following script to get the box to open/close again. there’s probably a better way to hook into the existing JS that does this.

    jQuery('#postexcerpt h3').click( function() {
    	jQuery(jQuery(this).parent().get(0)).toggleClass('closed');
    } );

    thank you for this self-resolved !

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘I moved a meta_box in the admin via jQuery but now it won’t open’ is closed to new replies.