• Resolved rinart73

    (@rinart73)


    I made some custom post types via CPTUI and I want them to have Neve metabox (to hide featured image for example). Hovewer it seems that it’s hardcoded to be used in posts and pages in file “inc\admin\metabox\manager.php”.

    This thread has a solution that no longer works because metabox also needs scripts and styles that are also restricted for posts and pages only.

    On top of that Manager is a final class meaning it can’t be extended.

    Please add filters that would allow to ‘extend’ metabox for custom post types.

    Basically replace this:

    public function meta_sidebar_script_enqueue() {
      global $post_type;
      if ( $post_type !== 'post' && $post_type !== 'page' ) {
        return false;
      }

    with this:

    public function meta_sidebar_script_enqueue() {
      global $post_type;
      $sidebar_post_types = apply_filters( 'neve_meta_sidebar_post_types', array( 'post', 'page' ) );
      if ( ! in_array( $post_type, $sidebar_post_types  ) )
        return false;
      }
    • This topic was modified 2 years, 5 months ago by rinart73.
    • This topic was modified 2 years, 5 months ago by rinart73.
    • This topic was modified 2 years, 5 months ago by rinart73.
    • This topic was modified 2 years, 5 months ago by rinart73.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to add Neve metabox to custom post types?’ is closed to new replies.