Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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
}
Source by developer.wordpress.org #
 
PREVIOUS NEXT
Tagged: #wordpress
ADD COMMENT
Topic
Name
3+5 =