如何在不是我的WordPress插件中添加新页面


How to add new page in not my Wordpress plugin?

我必须在wordpress插件中插入一个新函数,我用命令来完成

$bPage = add_submenu_page('hotel_option', __('Block room', 'gdlr-hotel'), __('Block room', 'gdlr-hotel'), 
            'edit_theme_options', 'block-room', 'block_room_option');
        add_action('admin_print_styles-' . $page, 'gdlr_transaction_option_style'); 
        add_action('admin_print_scripts-' . $page, 'gdlr_transaction_option_script');
        add_action('admin_print_styles-' . $bPage, 'block_room_style'); 
        add_action('admin_print_scripts-' . $bPage, 'block_room_script');

但是现在当我写一些类似简单<div>a</div>的东西时,WP 将我的div 放在 WP 升级框的上方,当我打开工具进行检查时,我看到元标签从正文标签内的头部标签切换,我的<div>a</div>出现在 wordpress 的每个页面中(也在登录页面中)!

我该如何解决?对不起我的英语

不能

直接在主文件(插件的配置)文件中写入HTML,它会在所有页面中显示数据

add_submenu_page ( string $parent_slug, string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' ) 

在此,最后一个参数是回调函数名称

// Add to admin_menu function
$page = add_submenu_page( 'edit.php?post_type=theme', __('Theme Page Options'), __('Theme Menu Options'), 'edit_themes', 'theme_options', theme_options);

function theme_options() {
        // do  the stuff of printing here
        // or include a file use include("my_viewpage.php") and write the div and html in this page
}

my_viewpage.php需要放置在该插件文件夹本身中

好的

,但是如果我包含另一个文件,我在此文件中编写的所有内容都会显示在升级框的上方,并且元标记位于正文标记内