“WordPress add_submenu_page” Kode Jawaban

WordPress Tambahkan submenu

add_menu_page('My Custom Page', 'My Custom Page', 'manage_options', 'my-top-level-slug');
add_submenu_page( 'my-top-level-slug', 'My Custom Page', 'My Custom Page',
    'manage_options', 'my-top-level-slug');
add_submenu_page( 'my-top-level-slug', 'My Custom Submenu Page', 'My Custom Submenu Page',
    'manage_options', 'my-secondary-slug');
loden

WordPress add_submenu_page


/**
 * °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°Adding settting page to the custom post type
 * menu id : menu-posts-portfolio (left sidebar)
 * 
 */

function books_register_ref_page() {
    add_submenu_page(
        'edit.php?post_type=portfolio',
        __( 'Portfolio Settings', 'portfolio' ), //page titlte
        __( 'Settings', 'portfolio' ), // submenu iteam name
        'manage_options',
        'portofile-setttings', //slug
        'books_ref_page_callback' //render age content
    );
}
add_action( 'init', 'books_register_ref_page', 0 ); //resgister the function
 

/**
 * Display callback for the submenu page.
 */
function books_ref_page_callback() { 
    ?>
    <div class="wrap">
        <p><?php _e( 'Helpful stuff here', 'portfolio' ); ?></p>
    </div>
    <?php
}
Singh99

Jawaban yang mirip dengan “WordPress add_submenu_page”

Pertanyaan yang mirip dengan “WordPress add_submenu_page”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya