“WordPress Ajouter un sous-menu sous le type de poste personnalisé” Réponses codées

sous-menu pour le type de publication dans wordpress

register_post_type( 'movies',
    array(
            'labels' => array(
                    'name' => __( 'Movies' ),
                    'singular_name' => __( 'Movie' )
            ),
    'public' => true,
    'has_archive' => true,
    'show_in_menu' => 'edit.php?post_type=entertainment'
    )
);

add_action('admin_menu', 'my_admin_menu'); 
function my_admin_menu() { 
    add_submenu_page('edit.php?post_type=entertainment', 'Genre', 'Genre', 'manage_options', 'edit-tags.php?taxonomy=genre&post_type=entertainment'); 
}
Vast Vendace

WordPress Ajouter un sous-menu sous le type de poste personnalisé

//// 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
}
Singh99

WordPress Ajouter un sous-menu sous le type de poste personnalisé

/**
 * °°°°°°°°°°°°°°°°°°°°°°°° Adding settting page to the custom post type°°°°°°°°°°°°°°°°°°°°°°°°
 * postType name : portfolio
 */

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">
        <h1><?php _e( 'Portfolio Settings', 'textdomain' ); ?></h1>
        <div><?php include_once('pages/settings.php')?></div>
    </div>
    <?php
}
Singh99

WordPress Ajouter un sous-menu sous le type de poste personnalisé

/**
 * °°°°°°°°°°°°°°°°°°°°°°°° Adding settting page to the custom post type°°°°°°°°°°°°°°°°°°°°°°°°
 * postType name : portfolio
 */

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">
        <h1><?php _e( 'Portfolio Settings', 'textdomain' ); ?></h1>
        <div><?php include_once('pages/settings.php')?></div>
    </div>
    <?php
}
Singh99

WordPress Ajouter un sous-menu sous le type de poste personnalisé

/**
 * °°°°°°°°°°°°°°°°°°°°°°°° Adding settting page to the custom post type°°°°°°°°°°°°°°°°°°°°°°°°
 * postType name : portfolio
 */

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">
        <h1><?php _e( 'Portfolio Settings', 'textdomain' ); ?></h1>
        <div><?php include_once('pages/settings.php')?></div>
    </div>
    <?php
}
Singh99

WordPress Ajouter un sous-menu sous le type de poste personnalisé

/**
 * °°°°°°°°°°°°°°°°°°°°°°°° Adding settting page to the custom post type°°°°°°°°°°°°°°°°°°°°°°°°
 * postType name : portfolio
 */

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">
        <h1><?php _e( 'Portfolio Settings', 'textdomain' ); ?></h1>
        <div><?php include_once('pages/settings.php')?></div>
    </div>
    <?php
}
Singh99

Réponses similaires à “WordPress Ajouter un sous-menu sous le type de poste personnalisé”

Questions similaires à “WordPress Ajouter un sous-menu sous le type de poste personnalisé”

Plus de réponses similaires à “WordPress Ajouter un sous-menu sous le type de poste personnalisé” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code