dimanche 1 mars 2015

Wordpress Admin Menu defining function is seperate file


here is my current code,


aio_menu.php



<?php
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
add_action( 'admin_menu', 'AIO_menu_creator' );
function AIO_menu_creator() {

add_menu_page( 'AIO WooCommerce Plugin', 'AIO', 'manage_options', 'aio-dashboard', plugins_url('AIO-WooCommerce-Plugin/menu/aio_dashboard.php'), plugins_url('AIO-WooCommerce-Plugin/ico.png') , '81.912514514511451' );
}
require_once 'aio_dashboard.php';

?>


aio_dashboard.php



<?php

function my_plugin_options() {
if ( !current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}
echo '<div class="wrap">';
echo '<p>Here is where the form would go if I actually had options.</p>';
echo '</div>';
}

add_action( 'current_screen', 'function_name' );

?>


the image of the page


in my main plugin file,


require_once 'menu/aio_menu.php';


I want to add sub menu items like, dashboard, shipping editor, price specifier and etc.


So, aio_menu will have all my menu's specified and i will have aio_dashboard and so on for the page content.


Now I want to align the content i get in the middle of the page and make sure the notifications which are shown are properly shown. I know I am doing something wrong in aio_dashboard file. Can anyone guide me through it and also help me add two submenus for aio_dashboard.php and aio_quotemanager.php


My top level menu name is AIO as you can see in the screenshot. So when clicking AIO it should redirect to aio-dashboard and it also should show aio-dashboard as submenu.





Aucun commentaire:

Enregistrer un commentaire