1

I'm building a custom post type entry screen (in code). I would like to have my fields display without a meta box surrounding them, so that they look more like the user profile page. Is that possible, without using a third-party plugin?

Is add_meta_box() the only way to display fields on an admin area post entry/edit screen?

4
  • 2
    Possible duplicate of Remove border on custom meta box
    – RRikesh
    Commented Feb 26, 2016 at 7:50
  • Sooo.... it sounds like there's no "WordPress Way" other than adding meta boxes?
    – eljefejb
    Commented Apr 26, 2017 at 17:04
  • You tried the answer in the above comment?
    – RRikesh
    Commented Apr 27, 2017 at 3:59
  • I'm sure that would work - it just seems like there ought to be a built-in PHP way to do it, without needing to bring in jQuery.
    – eljefejb
    Commented Apr 27, 2017 at 15:28

1 Answer 1

-1

Add this code in functions.php

add_action('admin_init', 'wpse_87339_admin_init');
function wpse_87339_admin_init() {
    wp_enqueue_script('wpse_87339_admin', get_stylesheet_directory_uri() . '/js/admin.js', array('jquery'));
}

and create new js file name admin.js and then add the below code in it

jQuery(document).ready(function($) {
    // Remove all .postbox classes from sidebar
    $('#side-sortables .postbox').removeClass('postbox');

    // Remove .postbox from specific metabox (page attributes)
    $('#pageparentdiv').removeClass('postbox');
});
2
  • Please properly format your posts Commented Feb 26, 2016 at 7:20
  • And don't copy your answers from other posts.
    – RRikesh
    Commented Feb 26, 2016 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.