Unable to add custom page to Wordpress admin panel

admin2025-06-05  2

I am trying to add a page to admin panel and following this tutorial here

admin-panel.php

function add_menu_to_wpadmin(){
    add_theme_page( 'Admin Contact Us', 'Subscriber list', 'manage_options', 'sublist', 'contactus_admin', 'dashicons-admin-customizer', 110 );
}
add_action('admin_menu', 'add_menu_to_wpadmin');

function contactus_admin(){
    echo "contact us";
}

functions.php

require get_template_directory().'/admin_panels/sublist_admin.php';
function static_files(){
    wp_enqueue_style('style', get_stylesheet_uri());
}

add_action('wp_enqueue_scripts', 'static_files');

I tried putting the entire code of admin-panel.php inside functions.php but it still didn't work. I also tried changing the position parameter from 110 to 6 (all based on numerous tutorials on the internet).

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749094012a316312.html

最新回复(0)