Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

wordpress add submenu under custom post type

//// portfolio is my custom post type

function books_register_ref_page() {
    add_submenu_page(
        'edit.php?post_type=portfolio',
        __( 'Books Shortcode Reference', 'portfolio' ),
        __( 'Shortcode Reference', 'portfolio' ),
        'manage_options',
        'portfolio-shortcode-ref',
        'books_ref_page_callback'
    );
}
add_action( 'init', 'books_register_ref_page', 0 );
 

/**
 * Display callback for the submenu page.
 */
function books_ref_page_callback() { 
    ?>
    <div class="wrap">
        <h1><?php _e( 'Books Shortcode  Reference','portfolio' ); ?></h1>
        <p><?php _e( 'Helpful stuff here', 'portfolio' ); ?></p>
    </div>
    <?php
}
 
PREVIOUS NEXT
Tagged: #wordpress #add #submenu #custom #post #type
ADD COMMENT
Topic
Name
2+4 =