Dinesh
Dinesh

Reputation: 4110

How to add my plugin link to admin left bar?

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

Upvotes: 0

Views: 312

Answers (1)

Krunal Shah
Krunal Shah

Reputation: 2101

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.

Upvotes: 1

Related Questions