pagehook = add_menu_page(__('All In One Metadata Settings', 'all-in-one-metadata'), "Metadata", 'manage_options', 'pressbooks_metadata_settings', array($this, 'render_options_page'), 'dashicons-search'); //small fix to have different menu name of first tab add_submenu_page('pressbooks_metadata_settings',__('General Settings', 'all-in-one-metadata'), __('General Settings', 'all-in-one-metadata'), 'manage_options', 'pressbooks_metadata_settings'); if(!site_cpt::pressbooks_identify()){ //Used to remove the default menu for the cpt we created remove_menu_page( 'edit.php?post_type=site-meta' ); remove_meta_box( 'submitdiv', 'site-meta', 'side' ); add_meta_box( 'metadata-save', __('Save Site Metadata Information', 'all-in-one-metadata'), array( $this, 'metadata_save_box' ), 'site-meta', 'side', 'high' ); $meta = site_cpt::get_site_meta_post(); if ( ! empty( $meta ) ) { $site_meta_url = 'post.php?post=' . absint( $meta->ID ) . '&action=edit'; } else { $site_meta_url = 'post-new.php?post_type=site-meta'; } //adding Site-Meta page under main plugin page add_submenu_page('pressbooks_metadata_settings','Site-Meta', 'Site-Meta', 'edit_posts', $site_meta_url); } //getting active locations for metadata $this->locations = get_option('schema_locations') ?: []; //Creating subpages for all active post types foreach ($this->locations as $location => $enabled) { if ( $enabled && ! ( $location == 'site-meta' || $location == 'metadata' ) ) { add_submenu_page( 'pressbooks_metadata_settings', ucfirst( $location ) . __(' Metadata Settings', 'all-in-one-metadata'), ucfirst( $location ) .' Metadata', 'manage_options', $location . '_meta_settings' , function () use ($location){ wp_enqueue_script('common'); wp_enqueue_script('wp-lists'); wp_enqueue_script('postbox'); //adding metabox to post options page add_meta_box('activated-schema-types', __('Active Schema Types', 'all-in-one-metadata'), array($this, 'render_metabox_active_schemas'), $location.'_meta_settings', 'normal', 'core'); ?>

Metadata Settings

pagehook, array($this, 'add_metaboxes')); } /** * Render the options page for plugin. * * @since 0.10 */ function render_options_page() { ?>

pagehook, 'normal',''); ?>
pagehook, 'normal', 'core'); add_meta_box('activated-schema-types', $site_level.__(' Settings', 'all-in-one-metadata'), array($this, 'render_metabox_active_schemas'), $this->pagehook, 'normal', 'core'); add_meta_box('general-settings', __('General Settings', 'all-in-one-metadata'), array($this, 'render_general_settings'), $this->pagehook, 'normal', 'core'); } /** * Render data for the metabox. * * @since 0.10 */ function render_metabox_schema_locations() { include_once plugin_dir_path( dirname( __FILE__ ) ) . 'partials/pressbooks-metadata-admin-settings-schemaLocations.php'; } /** * Render data for the active_schemas metabox. * * @since 0.10 */ function render_metabox_active_schemas(){ include_once plugin_dir_path( dirname( __FILE__ ) ) . 'partials/pressbooks-metadata-admin-settings-activeSchemas.php'; } /** * Render data for the general_settings metabox. * * @since 0.x */ function render_general_settings(){ include_once plugin_dir_path( dirname( __FILE__ ) ) . 'partials/pressbooks-metadata-admin-settings-general.php'; } /** * A function that manipulates the inputs for saving the new cpt data * @since 0.9 */ function metadata_save_box( $post ) { if ( 'publish' === $post->post_status ) { ?>