dongzhanbi0027 2016-02-02 06:48 采纳率: 0%
浏览 198

无法在wordpress中添加菜单

    $page_title = "PushBIZ.IN";
    $menu_title = "PushBIZ.IN";
    $capability = 'activate_plugins';
    $menu_slug  = "pushbiz";
    $function   = "PushBIZIN_first";

    add_menu_page( __('Getting Started'), $menu_title, $capability, $menu_slug, array($this, $function), plugins_url( WPPUSH_APPNAME.'/assets/images/app20x20.png' ) ); 
    add_submenu_page( $menu_slug, __('BIZ Message'), __('BIZ Message'), $capability, 'BIZMessage', array($this, 'BIZ_Message') );   
    add_submenu_page( $menu_slug, __('Business Analyst'), __('Business Analyst'), $capability, 'businessanalyst', array($this, 'business_analyst') );
    add_submenu_page( $menu_slug, __('BIZ Interests'), __('BIZ Interests'), $capability, 'BIZinterests', array($this, 'BIZ_interests') );

Warning: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in C:\wamp\www\wp\wp-includes\plugin.php on line 525

  • 写回答

2条回答 默认 最新

  • dqalnwuci494308 2016-02-02 07:00
    关注

    ADD menu and sub-menu in word-press admin panel -> try this

    function jmenu_plugin_top_menu(){
       add_menu_page('My Plugin', 'My Plugin', 'manage_options', __FILE__, 'jmenu_render_plugin_page', plugins_url('/img/icon.png',__DIR__));
       add_submenu_page(__FILE__, 'Custom', 'Custom', 'manage_options', __FILE__.'/custom', 'jmenu_render_custom_page');
       add_submenu_page(__FILE__, 'About', 'About', 'manage_options', __FILE__.'/about', 'jmenu_render_about_page');
     }
     function jmenu_render_plugin_page(){
      ?>
       <div class='wrap'>
        <h2>plugin page</h2>
       </div>
      <?php
     }
     function jmenu_render_custom_page(){
       ?>
       <div class='wrap'>
        <h2>my sub page</h2>
       </div>
       <?php
     }
     function jmenu_render_about_page(){
       ?>
       <div class='wrap'>
        <h2>About my plugin page</h2>
       </div>
       <?php
     }
    
     add_action('admin_menu','jmenu_plugin_top_menu');
    

    it will add menu and sub-menu in admin panel.

    enter image description here

    You can also refer this links for adding menu and submenu in admin panel.

    http://clivern.com/adding-menus-and-submenus-for-wordpress-plugins/

    https://developer.wordpress.org/reference/functions/add_submenu_page/

    评论

报告相同问题?

悬赏问题

  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算