wordpress/wp-content/plugins/cms-tree-page-view/functions.php
// Add items to the wp admin menu
Add items to the wp admin menu
Add items to the wp admin menu
function cms_tpv_admin_menu() {
	$options = cms_tpv_get_options();
	foreach ($options["menu"] as $one_menu_post_type) {
		if ( cms_tpv_post_type_is_ignored($one_menu_post_type) ) {
			continue;
		}
		if ($one_menu_post_type == "post") {
			$slug = "edit.php";
		} else {
			$slug = "edit.php?post_type=$one_menu_post_type";
		}
		$post_type_object = get_post_type_object($one_menu_post_type);
				if ( ! empty( $post_type_object ) ) {
			$menu_name = _x("Tree View", "name in menu", "cms-tree-page-view");
			$page_title = sprintf(_x('%1$s Tree View', "title on page with tree", "cms-tree-page-view"), $post_type_object->labels->name);
			add_submenu_page($slug, $page_title, $menu_name, $post_type_object->cap->edit_posts, "cms-tpv-page-$one_menu_post_type", "cms_tpv_pages_page");
		}
	}
	$page_title = apply_filters("cms_tree_page_view_options_page_title", CMS_TPV_NAME);
	$menu_title = apply_filters("cms_tree_page_view_options_menu_title", CMS_TPV_NAME);
	add_submenu_page( 'options-general.php', $page_title, $menu_title, "administrator", "cms-tpv-options", "cms_tpv_options");
}
function cms_tpv_admin_menu ( ) { $ options = cms_tpv_get_options ( ) ; foreach ( $ options [ " menu " ] as $ one_menu_post_type ) { if ( cms_tpv_post_type_is_ignored ( $ one_menu_post_type ) ) { continue ; } if ( $ one_menu_post_type == " post " ) { $ slug = " edit.php " ; } else { $ slug = " edit.php?post_type= $ one_menu_post_type " ; } $ post_type_object = get_post_type_object ( $ one_menu_post_type ) ; if ( ! empty ( $ post_type_object ) ) { $ menu_name = _x ( " Tree View " , " name in menu " , " cms-tree-page-view " ) ; $ page_title = sprintf ( _x ( '%1$s Tree View' , " title on page with tree " , " cms-tree-page-view " ) , $ post_type_object -> labels -> name ) ; add_submenu_page ( $ slug , $ page_title , $ menu_name , $ post_type_object -> cap -> edit_posts , " cms-tpv-page- $ one_menu_post_type " , " cms_tpv_pages_page " ) ; } } $ page_title = apply_filters ( " cms_tree_page_view_options_page_title " , CMS_TPV_NAME ) ; $ menu_title = apply_filters ( " cms_tree_page_view_options_menu_title " , CMS_TPV_NAME ) ; add_submenu_page ( 'options-general.php' , $ page_title , $ menu_title , " administrator " , " cms-tpv-options " , " cms_tpv_options " ) ; }
Add items to the wp admin menu
Add items to the wp admin menu
// add // post is a special one. // Only try to add menu if we got a valid post type object // I think you can get a notice message here if you for example have enabled // the menu for a custom post type that you later on remove?
