Comments (7)
Hi,
Use the show_in_menu
custom post type argument. For an existing admin page root menu created with Admin Page Framework, pass the admin page class name as it serves as the menu slug.
I've uploaded example plugins.
- to add a custom post type submenu item to an existent admin page root menu (see)
- to add a custom post type submenu item to an existent custom post type root menu (see)
from admin-page-framework.
Hi @michaeluno Thanks for your attention.
I tried the following code snippet but unfortunately, the submenu don't reigster. The post type is created and the root menu is there. It's just the submenu doesn't appear in the parent menu.
class APFDemo_CPTSubmenu_AdminPage extends AdminPageFramework {
public function setUp() {
$this->setRootMenuPage( 'CPT Demo - CPT Submenu','dashicons-welcome-widgets-menus', 100 );
$this->addSubMenuItems(
array(
'title' => 'Main',
'page_slug' => 'apf_demo_cpt_submenu_main',
'order' => 10,
)
);
}
/**
* @callback do_{page slug}
*/
public function do_apf_demo_cpt_submenu_main() {
echo "<p>Hello.</p>";
}
}
class APFDemo_CPTSubmenu_PostType_A extends AdminPageFramework_PostType {
public function setUp() {
$this->setArguments(
array(
'labels' => array(
'name' => 'CPT Submenu A',
'menu_name' => 'CPT Submenu A',
),
'show_ui' => true,
'show_in_menu' => 'APFDemo_CPTSubmenu_AdminPage',
'submenu_order_manage' => 20,
)
);
}
}
new APFDemo_CPTSubmenu_AdminPage;
new APFDemo_CPTSubmenu_PostType_A('cpt_newtest', null, __FILE__);
from admin-page-framework.
In your code, extendsAdminPageFramework {
will code an error. Try the examples shown on Gist linked in my previous reply. They can be downloaded as a zip file and run as a plugin. Install them on your test site with the Admin Page Framework - Loader plugin activated.
from admin-page-framework.
Hi @michaeluno
It's a typo with my example but it's already set as extends AdminPageFramework
in the plugin that i'm working on. I'm also able to create root pages, section and fields.
Regards,
from admin-page-framework.
Try the example plugins on a test site which only activates the Admin Page Framework - Loader plugin, NOT on your development plugin in order to eliminate any possible factors which cause problems.
The steps you need to take is:
- Create a test site with no plugins and with the default theme.
- Install and activate the Admin Page Framework - Loader plugin.
- Install and activate the example plugin.
And see what happens. If it doesn't give you a desired result, post screenshots.
from admin-page-framework.
Hi @michaeluno
Good news! I'm able to make it work now within the development plugin. It was an issue with my class calls.
I've changed it from 'show_in_menu' => 'Admin_Settings',
to 'show_in_menu' => '\The_Subscription\Admin_Settings',
Thank you very much for your guidance!
Regards,
from admin-page-framework.
Okay, great.
from admin-page-framework.
Related Issues (20)
- Bug: 'save' attribute of sections and inputs doesn't work with Page MetaBox. HOT 2
- Plugin is not working in french? HOT 3
- Radio input is not working HOT 2
- Select2 on AdminPageFramework_MetaBox not found on 3.8.18 HOT 8
- Select2 loses feature select2 when the field is repeated HOT 4
- Problem to work on Wordpress.com HOT 3
- Notice: Undefined index: file in admin-page-framework\library\apf\factory\_common\utility\base_utility\AdminPageFramework_Utility.php on line 424 HOT 1
- Repeatable options cannot be saved properly when namespace declared. HOT 2
- When a rich text field is edited, the formatting of the text is lost. HOT 1
- jQuery issue with WordPress 5.6 & PHP 8.0 HOT 3
- Character \ is removed from any field HOT 2
- Incompatibility of metabox in admin pages when moving to PHP 8 HOT 2
- Documentation improvements. HOT 1
- Problems with text baseline when using inline_mixed, Chromium, Chrome, Edge only. HOT 1
- Can't force the subpages to belong to custom main pages created without the the framework HOT 1
- Many deprecated warnings with php 8.1 HOT 1
- wordpress dot org plugin directory: sanitize, validate, escape
- Not displaying usermeta values in user editing in admin
- Deprecation notices for php 8.1 and 8.2.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from admin-page-framework.