Friday 26 April 2013

HOW TO ADD NEW ITEMS IN ADMIN MENU OF WORDPRESS

Wordpress is power full open source content management system. With the use of wordpress you will make our web site in easy way. The wordpress cms also save the time of the web developer. There is lot of functions and resource already available so need only use them. It also help in advertise our self. Once you configure the wordpress on our domain then there is lot of themes are available from which you can choose the different themes and your site become ready in our choice theme.

Today you will learn how to add new items in the wordpress admin menu. This i tell using plugin. So follow the below steps.

Steps 1: Creating the folder in wp-content\plugins\ in this folder create the new folder there is name test_plugin

Step 2: Creating the a new file in the test_plugin like index.php and paste the following code.

Code

<?php
/*
Plugin Name: Insert Page in admin menu
Plugin URI:
http://rakeshkumar125.wordpress.com
Description: This plugin shows you how to add page in admin menu
Author: Rakesh Kumar
Author URI:
http://rakeshkumar125.wordpress.com
*/

// Hook for adding admin menus
add_action(‘admin_menu’, ‘mt_add_pages’);
// action function for above hook
function mt_add_pages() {
// Add a new top-level menu (ill-advised):
add_menu_page(__(‘Your Menu Title’), __(‘Your Menu name’), ‘manage_options’, ‘mt-top-level-handle’, ‘mt_toplevel_page’ );
}
// mt_toplevel_page() displays the page content for the custom Test Toplevel menu
function mt_toplevel_page() {
echo “
” . __( ‘page contents for the menu’ ) . “
“;
}
?>

In the above code the bold lines just shows the description of the user who create the plugin.

No comments:

Post a Comment