dongxi0605 2013-10-14 11:41
浏览 36
已采纳

如何将我的插件链接添加到管理员左栏?

It is my first plugin in wordpress, so I do not known by how to set my own created plugin to left admin bar...like other plugin wp-member, profile builder have.

I created a simple plugin just as:

<?php
/*
Plugin Name: Contact
Plugin URI: http://www.mysites.com/
Description: Add/Remove links in the WordPress admin bar.
Version: 0.1
Author: D K
Author URI: http://www.abcd.com/
License: GPL2
*/

?>



    <div id="primary" class="site-content">
        <div id="content" role="main">


<form action="<?php the_permalink(); ?>" id="contactForm" method="post">
     <ul>
        <li>
            <label for="contactName">Name:</label>
            <input type="text" name="contactName" id="contactName" value="" />
        </li>
        <li>
            <label for="email">Email</label>
            <input type="text" name="email" id="email" value="" />
        </li>
        <li>
            <label for="commentsText">Message:</label>
            <textarea name="comments" id="commentsText" rows="20" cols="30"></textarea>
        </li>
        <li>
            <button type="submit">Send email</button>
        </li>
    </ul>
    <input type="hidden" name="submitted" id="submitted" value="true" />
</form>

        </div><!-- #content -->
    </div><!-- #primary -->

It is working fine but I want it on the left side bar of admin...If it is not possible to give full guidelines here then give me some link or tutorial link on how I can do this because I have almost spent 2 hours on this and I am still at the same point...

Many thanks

  • 写回答

1条回答 默认 最新

  • dtmu88600 2013-10-14 11:59
    关注

    to develop a plugin you should also include this in your plugin file.

    function abcd() {
        if (is_admin()){            
            add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );
        }
    }
    add_action('admin_menu', 'abcd');
    

    add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );

    will help you to show on admin left bar.

    Thanks.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器