• Hello!

    Is there a way to move GP’s “Layout” metabox to the sidebar? Currently it appears below the main editor window.

    In my case, I have a bunch of CPT’s and custom fields, and have users who’s primary focus should only be on content writing and any custom fields appearing below the editor window. Anything else is a distraction and takes up real estate.

    IMHO, miscellaneous-page-related-options-used-only-once-in-awhile should be kept with other MPROUOOIA’s… in the sidebar, in “Document”.

    • This topic was modified 5 years, 10 months ago by MountainSmoke.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter MountainSmoke

    (@mountainsmoke)

    Ok, here’s a solution…

    Note: If you’ve previously toggled the Layout metabox via ‘Screen Options’, this change may not work for you; you may still continue to see the Layout metabox at the bottom of the main editor view. Other users, e.g. new users, will see the metabox in the sidebar.

    Add the following to functions.php:

    add_action( 'add_meta_boxes', 'my_script_modify_gp_metabox', 999 );
    
    function my_script_modify_gp_metabox() {
    
      $post_types = get_post_types( array( 'public' => true ) );
    
    	foreach ( $post_types as $type ) {
    		if ( 'attachment' !== $type ) {
    
    // removes current GP metabox
          remove_meta_box('generate_layout_options_meta_box', $type, 'normal');
    
    // adds new instance of GP metabox
          add_meta_box(
    				'generate_layout_options_meta_box',
    				esc_html__( 'Layout', 'generatepress' ),
    				'generate_do_layout_meta_box',
    				$type,
    
                                    // Controls metabox position. Alternatively, set 'normal' or 'advanced'.
    				'side',
    				'high'
    			);
    
    		}
    	}
    }
    • This reply was modified 5 years, 10 months ago by MountainSmoke.
    Theme Author Tom

    (@edge22)

    Hi there,

    You should be able to just drag it into the sidebar: https://www.useloom.com/share/42d184e351b44829985940ac506698a8

    It’s a little glitchy in Gutenberg, but it works.

    Let me know ??

    Thread Starter MountainSmoke

    (@mountainsmoke)

    Hi Tom,

    I figured Gutenberg-dragging would work by now; it didn’t for me last time I looked. Dragging to the sidebar is a good option in some cases.

    Anyhow, I’d still like to have the sidebar as default for new users just for a smoother/cleaner experience.

    With the code above, do you see any problems? ie de-registering/re-registering a metabox, is it the cleanest way?

    • This reply was modified 5 years, 10 months ago by MountainSmoke.
    Theme Author Tom

    (@edge22)

    We’ll be moving the metabox to the sidebar permanently in GP 2.3. Your code should be fine to use until we do that ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Editor view: Move GP’s “Layout” metabox to sidebar’ is closed to new replies.