Take the 2-minute tour ×

I'm completely new to WPMVC. Followed and finished their tutorial for creating plugins. Now I'm trying to add a search page to search Venues (that comes from their example!). This page should appear as a submenu page of the Venues menu. I created a file named search.php in the app/views/admin/venue/search folder. What should I do now? Googling didn't help much!

Any help regarding this (and any other stuff a noob should learn to get better with WPMVC) is welcome!

share|improve this question

2 Answers 2

Finally after a lot of digging into the core files, I found the way to add a submenu page. Here's the stepwise solution if anyone is stuck on it!

Lets assume you want to add a submenu page called 'Sample'.

1.First, in the app/config/bootstrap.php file (you have to manually create it if it doesn't exist) of your plugin, add the following code. This will add the new page as a submenu of the venues parent menu item:

//sample is appended to the venues array, meaning it will be a submenu page of venues
'AdminPages' => array(
    'venues' => array(

2.Next, in the app/controllers/admin/admin_venues_controller.php add the following function. Notice it is named sample, same as the page name in the array above.

function sample() {
    //this array will be available as $values in the sample.php file
    $vals = array('great' => 'Done', 'nice' => 'Finally');
    $this->set('values', $vals);

3.Now the actual page content file, create a sample.php (notice the name) file in the app/views/admin/venues/ folder.

    echo '<h2>'.MvcInflector::titleize($this->action).'</h2>';
    //remember the values variable set in the controller? 
    foreach($values as $i => $val){ ?>
        echo $i.' = '.$val;

That's pretty much it! I'm still stuck on creating a top level menu page without having to create a model (models get top level pages by default). Will update this answer when I solve it!

Note: Emailing Tom Benner, the creator of WPMVC didn't help too! ;)

share|improve this answer

enter image description hereHere is a solution:

Add an action hook in your plugin main file 'plugin_name.php', giving the details of the menu. You can have an admin menu, of course without generating a model.

Here is the code:


add_action( 'admin_menu', 'my_custom_menu_page' );

function my_custom_menu_page() {

    add_menu_page( 'My Menu', 'My Menu', 'manage_options', 'myplugin/myplugin-admin.php', '', plugins_url( 'myplugin/images/icon.png' ), 6 );

You can leave the image location to empty for a default wordpress icon for the custom menu.

Ofcourse, you can add submenus in the same way or using bootstrap.php as well.

This works fine.

In the picture above, I have added 'My Menu' by this method.

share|improve this answer

Your Answer


