这里是我的随机问题。我有几个自定义的帖子类型注册到Wordpress,我想将归档页面添加到菜单中,但我不希望它们是静态链接。
有没有办法通过插件等将自定义帖子类型添加到Wordpress菜单中,并让层次结构菜单类的东西很好地工作?
E、 G我有一个作业CPT,我只想添加一个作业菜单项,该菜单项将链接到该CPT的存档。
这里是我的随机问题。我有几个自定义的帖子类型注册到Wordpress,我想将归档页面添加到菜单中,但我不希望它们是静态链接。
有没有办法通过插件等将自定义帖子类型添加到Wordpress菜单中,并让层次结构菜单类的东西很好地工作?
E、 G我有一个作业CPT,我只想添加一个作业菜单项,该菜单项将链接到该CPT的存档。
使用参数\'show_in_menu\'
在函数中register_post_type()
将此CPT添加到菜单。也可以在现有或创建的菜单项中用作子菜单。现在,以一个示例将此作为子菜单添加到现有自定义帖子类型中。
// This custom post type will be added as a submenu to the \'Portfolio\' menu
$args = array(
\'labels\' => array(
\'all_items\' => \'Locations\',
\'menu_name\' => \'Locations\',
\'singular_name\' => \'Location\',
\'edit_item\' => \'Edit Location\',
\'new_item\' => \'New Location\',
\'view_item\' => \'View Location\',
\'items_archive\' => \'Location Archive\',
\'search_items\' => \'Search Locations\',
\'not_found\' => \'No locations found.\',
\'not_found_in_trash\' => \'No locations found in trash.\'
),
\'supports\' => array( \'title\', \'editor\', \'revisions\' ),
\'show_in_menu\' => \'edit.php?post_type=portfolio\',
\'public\' => TRUE
);
register_post_type( \'location\', $args );
作为我上一次关于菜单的未解决查询的后续,这个问题已经进一步扩展。我的菜单没有打印代码中的任何地方。我正在注册菜单功能。php:add_action( \'after_setup_theme\', \'your_newtheme_setup\' ); if ( ! function_exists( \'your_newtheme_setup\' ) ) : function your_newtheme_setup() { if (