以下其中一行是在管理面板中破坏我的媒体页面。
// adds the page to the wp admin panel
add_action("admin_menu", "lec_add_page"); // runs lec_add_page()
// adds the page to the top menu level on the admin panel
function lec_add_page() {
add_menu_page("Live Events Calendar", "Live Events Calendar", "manage_options", "live-events-calendar-admin.php", "lec_create_page", plugins_url("live-events-calendar/images/calendar.png"));
}
// building the page
function lec_create_page() { ?>
<?php echo "Admin Page Test"; ?>
<?php } ?><!-- END lec_create_page() -->
这是以太add_action(“admin_menu”...或者add_menu_page(...行。我确定我把它们弄好了。我看过其他插件我已经激活了,他们有相同的线路实现了以同样的方式,他们不会干扰媒体页面。
在它自己的媒体页面上,它在加载时默认为网格,看起来它是连续加载(旋转球)没有图像显示。如果我点击列表视图然后它会加载所有图像,但再次单击网格视图仍然只是坐在那里。
非常感谢任何帮助。
哦和WP 4.1.1如果有帮助的话。
干杯。
答案 0 :(得分:0)
菜单slug 应该包含插件的名称,例如&#34; myplugin / live-events-calendar-admin.php &#34;。以下是 codex
的代码add_action( 'admin_menu', 'register_my_custom_menu_page' );
function register_my_custom_menu_page(){
add_menu_page( 'custom menu title', 'custom menu', 'manage_options', 'custompage', 'my_custom_menu_page', plugins_url( 'myplugin/images/icon.png' ), 6 );
}
function my_custom_menu_page(){
echo "Admin Page Test";
}