WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Hide/move custom meta boxes (5 posts)

  1. David Gard
    Member
    Posted 3 years ago #

    Hey all,

    I'm trying to neaten up the back end of my site where I have added a few pages, and I'm trying to make my meta boxs all swish and nifty like the one on the Dashboard for example (where you can drag them and move them around).

    I found some example code but can't seem to get it to work - just wondering if anybody is able to spot any errors/omisisons with the below code?

    Thanks.

    <div id="screen-main-container" class="wrap">
    
    	<?php screen_icon('options-general') ?>
    	<h2>Screen Title</h2>
    	<?php write_custom_admin_message($message, $class); ?>
    
    	<div id="cudtom-branding" class="metabox-holder">
    
    		<div class="postbox-container" style="width: 49%;">
    
    			<div id="normal-sortables" class="meta-box-sortables">
    
    				<div id="meta-box-id-1" class="postbox">
    					<div class="handlediv" title="Click to toggle"><br /></div>
    					<h3>Header</h3>
    					<div class="inside">
    						{meta-box contents go here}
    					</div>
    				</div>
    
    				<div id="meta-box-id-2" class="postbox">
    					<div class="handlediv" title="Click to toggle"><br /></div>
    					<h3>Login Screen</h3>
    					<div class="inside">
    						{meta-box contents go here}
    					</div>
    				</div>
    
    			</div>
    
    		</div>
    
    	</div>
    
    </div>
  2. David Gard
    Member
    Posted 3 years ago #

    Ok, so found this tutorial and associated example plugin - the English isn't perfect, but the example was easy to follow and to make amendments to.

  3. Mark / t31os
    Moderator
    Posted 3 years ago #

    Same tutorial i followed when i first did it.. ;)

    Personally i've found the overhead of loading all the required scripts to not be worth it.. unless your plugin really needs that functionality...

    For most things a little custom written jQuery ends up being a whole lot lighter..

  4. jayc
    Member
    Posted 3 years ago #

    Is there a way to have some admin panels minimized/collapsed by default?

    Thanks

  5. WebTechGlobal
    Member
    Posted 3 years ago #

    jayc that is easy done using the class...

    <div class="postbox closed">

    and

    <div class="postbox">

    Obviously with a bit of php you could make it more dynamic, say if there is a form within your postbox and it has been submitted but you want the user to return to the form, you would also want the postbox to stay open.

    Used such approaches in Easy CSV Importer, one page has a list of 8 post boxes each with forms.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.