[英]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升級框的上方,當我打開檢查工具時,我發現meta標簽從body標簽內部的head標簽切換了,我的<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放置在該插件文件夾中
好的,但是如果我包含另一個文件,則我在此文件中寫入的所有內容都將顯示在升級框上方,而meta標簽位於body標簽內
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.