{"id":107,"date":"2014-05-14T16:35:22","date_gmt":"2014-05-14T16:35:22","guid":{"rendered":"http:\/\/localhost\/syllogic\/wp\/?p=107"},"modified":"2024-02-02T12:22:27","modified_gmt":"2024-02-02T12:22:27","slug":"managing-dashboard-menus-sybmenus-and-labels","status":"publish","type":"post","link":"http:\/\/localhost:10008\/managing-dashboard-menus-sybmenus-and-labels\/","title":{"rendered":"Managing Dashboard Menus, Sub-menus and Labels"},"content":{"rendered":"\n
A recent project saw adopt the Vertex Elegant Theme<\/a> which comes with a pre-built set of custom posts to create diverse content. The theme has 3 built-in custom posts:<\/p>\n\n\n\n The requirement from the client is to use the theme for an online magazine. They have a group of editors and authors working on the current issue, with various sections to the magazine.<\/p>\n\n\n\n So the challenge was 2-fold:<\/p>\n\n\n\n So working around the idea of each article being a post, each being in a given section of the magazine (a post category) and at the same time being able to connect to past issues with keywords (or post tags), we wanted to dissociate the current issue from past issues so as to confuse the editors and authors when editing posts.<\/p>\n\n\n\n We also wanted to reuse a common set of keywords to connect old articles new ones.<\/p>\n\n\n\n We achieved this by by reusing the main Posts that comes with the default installation of WordPress as the Past Issues of the magazine.<\/p>\n\n\n\n We then changed the Project custom post of the Vertex theme to manage the current issue.<\/p>\n\n\n\n And since we were using the registered users to display the editorial team details, we decided that we did not need the Team Member custom post that was automatically installed with the Vertex theme.<\/p>\n\n\n\n All in all we need to do the following custom coding:<\/p>\n\n\n\n Here is how we went about it…<\/p>\n\n\n\n The challenge above is relatively straightforward when one knows what to change, the real challenge is to actually to find what to change<\/em>.<\/p>\n\n\n\n This is what this post is all about as I try to drop little white stones on my exploration of the WordPress jungle so-to-speak.<\/p>\n\n\n\n My first clue<\/a> came from the answer provided to someone’s question along similar lines about changing menus in the dashboard. However, it wasn’t sufficient to give me an overview of the logic behind the answer. So I went about digging further, but the only things I could find where wordpress codex functions on adding\/removing menus<\/a> and nothing on changing the name.<\/p>\n\n\n\n The codex has a section the admin menus hooks which is what the above answer is using, but I was intrigued about the reference to the the A recent project saw adopt the Vertex Elegant Theme which comes with a pre-built set of custom posts to create diverse content. The theme has 3 built-in custom posts: The requirement from the client is to use the theme for an online magazine. They have a group of editors and authors working on the current […]<\/p>\n","protected":false},"author":2,"featured_media":353,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,12],"tags":[],"yoast_head":"\n\n
\n
\n
The WordPress challenge….<\/h3>\n\n\n\n
Changing menus<\/h4>\n\n\n\n
Modifying the functions.php<\/h4>\n\n\n\n
add_action( 'admin_menu', 'sy_change_admin_menu' );\nfunction sy_change_admin_menu() {\n\u00a0\u00a0\u00a0 global $menu;\n\u00a0\u00a0\u00a0 global $submenu;\n\u00a0\u00a0\u00a0 \/\/let-s remove the team-member post_type menu\n\u00a0\u00a0\u00a0 remove_menu_page( 'edit.php?post_type=team-member' );\n\u00a0\u00a0\u00a0 \/\/let's add the tags sub-menu to the post_type projects\n\u00a0\u00a0\u00a0 register_taxonomy_for_object_type( 'post_tag', 'project' );\n\u00a0\u00a0\u00a0 add_submenu_page( 'edit.php?post_type=project', 'Keywords', 'Keywords', 'manage_categories', 'edit-tags.php?taxonomy=post_tag', '' );\n\u00a0\u00a0\u00a0 \/\/project post_type renamed to Current Issue\n\u00a0\u00a0\u00a0 $menu[26][0] = 'Current Issue';\n\u00a0 \u00a0\u00a0\u00a0 \u00a0$submenu['edit.php?post_type=project'][5][0] = 'All Articles';\n\u00a0\u00a0\u00a0 $submenu['edit.php?post_type=project'][15][0] = 'Sections'; \/\/ Change name for categories\n\u00a0\u00a0\u00a0 \/\/post post_type renamed to Past Issues\n\u00a0\u00a0\u00a0 $menu[5][0] = 'Past Issues';\n\u00a0 \u00a0\u00a0\u00a0 \u00a0$submenu['edit.php'][5][0] = 'All Articles';\n\u00a0\u00a0\u00a0 $submenu['edit.php'][15][0] = 'Sections'; \/\/ Change name for categories\n\u00a0\u00a0\u00a0 $submenu['edit.php'][16][0] = 'Keywords'; \/\/ Change name for tags\n\u00a0\u00a0\u00a0 echo '';\n}<\/code><\/pre>\n\n\n\n
global $menu<\/code> and
$submenu<\/code> objects. So I devised a small function to explore the structure of these objects as an empirical guide to modifying the dashboard menu.<\/p>\n","protected":false},"excerpt":{"rendered":"