Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

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 for /plugins/my-plugin/my_plugin.php

add_action( 'admin_menu', 'my_custom_menu_page' );    
function my_custom_menu_page() {
        'My Menu', 
        'My Menu', 
        plugins_url( 'myplugin/images/icon.png' ), 

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

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

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

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.