'The add menu callback function doesn't work in wordpress mvc ? Why?
I am newbie in wordpress mvc of https://www.wordpress-mvc.com/. When I try to add a new menu in plugin, a menu appears. But the callback function ideapro_scripts_page doesnt' work.
In Main.php
public function on_admin()
{
$this->add_action( 'admin_menu', 'MenuController@adminMenu');
}
In Menucontroller.php:
public function adminMenu()
{
add_menu_page('Header & footer scripts', 'Site scripts', 'manage_options', 'ideapro-admin-menu', 'ideapro_scripts_page', 'dashicons-editor-table', 200);
}
function ideapro_scripts_page()
{
?>
<div class="wrap">
<h2>
Update Scripts on the header and footer
</h2>
</div>
<?php
}
ideapro_scripts_page() function doesn't show anything in web. What is wrong in it?
Solution 1:[1]
In Your Menucontroller.php
public function adminMenu(){
add_menu_page(
'Mobile Api Events',
'Mobile Api Events',
'manage_options',
'mobile-api-events',
array($this,'render' ),
);
}
public function render(){
return $this->view->show('admin');
}
in view/admin file you can write the html code
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | whitehawk321 |