SoporteCategory: \admin class not found
Pradeep asked 5 years ago

Hello Carlos,
I found the reference from CMB2 plugin documentation and give it a try.
This framework is well written and simple to understand, thanks for such great efforts.
I git cloned it and changed my namespace (CP),
I uncommented the code to activate admin pages and visited to admin page and it gave me error.

call_user_func_array() expects parameter 1 to be a valid callback, class ‘CP\Admin’ not found in C:\xampp\htdocs\plugindevelopment\wp-includes\class-wp-hook.php on line 286

After changing the line in config file,
from

“function” => __NAMESPACE__.”\Admin::option_page”,
to

“function” => __NAMESPACE__.”Admin\Admin::option_page”,
 

It worked, but content in the function dosent came to screen.

again I changed function to,

$title = ‘<h2>Hello World</h2>’;
echo $title;
// return $title;

It worked.

Is this need to do or there is another way to do it.

By the way, I am very thankful for such a helpful framework.

1 Answers
Carlos Herrera Staff answered 5 years ago

Hello, Thank you very much for using the Antonella framework !. My English is not very good, but I will try to answer as understandable as possible.
Another option is to create a Controller with:

php antonella make YourMethodController

and placing in the creation of the menu in config.php

“Function” => __NAMESPACE __ .’\ YourMethodController :: your_function’.

you can create a variable and place html or doing an include of a php file that contains html.
There are tutorials to work with the Framework but they are in Spanish. The first video is almost translated subtitles. I leave the url

https://www.youtube.com/channel/UCFxXskKnVefX7IJ96aLxKRA
Regards