Tutorial: Condensing the Flutter menu

One of the few flaws we've found with Freshout's WordPress plugin entitled Flutter is the manner in which it displays Custom Write Panels. Flutter lists the Write Panels in the WordPress navigation under no distinct heading. WordPress breaks the navigation down in an orderly fashion for us: Dashboard, Posts, Media, Links, etc. only to be interrupted by what typically turns into five to eight Custom Write Panels making a mess of the usability. The problem becomes truly evident when combining it with Ozh's Drop Down Menu plugin where the added horizontal menu can quickly be overwhelmed by multiple Custom Write Panels pushing the Ozh menu down into two lines.

What we propose is a more effective method of organization. By removing the Custom Write Panels from the main navigation and placing them under their respective headers of Posts and Pages, we not only save space but give the Custom Write Panels a more logical, user-friendly placement. In order to accomplish this, we need to make an alteration to the RCCWP_Menu.php file.

Remove the following from RCCWP_Menu.php lines 432 to 456 ( Flutter version 1.1 )

if ($panel->type == "post"){
 if($panel->single == 1){  //if the post is single
 if($add_post){ //if the post is single and don't have any related post
 add_submenu_page($base+$offset.'.php', __($panel->name), $new_indicator_text, $requiredPostsCap, 'post-new.php?custom-write-panel-id=' . $panel->id);
 }else{ //if have one related post we just can  edit the post
 add_submenu_page($base+$offset.'.php',__($panel->name),"Edit", $requiredPostsCap,'post.php?action=edit&post='.$has_posts);
 }   
 }else{
 add_submenu_page($base+$offset.'.php', __($panel->name), $new_indicator_text, $requiredPostsCap, 'post-new.php?custom-write-panel-id=' . $panel->id);
 add_submenu_page($base+$offset.'.php', __($panel->name), $edit_indicator_text, $requiredPostsCap, 'edit.php?filter-posts=1&custom-write-panel-id=' . $panel->id);
 }
 }else{
 if($panel->single == 1){ //if the page is single
 if($add_post){ //if the page is single and don't have any related post
 add_submenu_page($base+$offset.'.php', __($panel->name), $new_indicator_text, $requiredPagesCap, 'page-new.php?custom-write-panel-id=' . $panel->id);
 }else{
 add_submenu_page($base+$offset.'.php',__($panel->name),"Edit", $requiredPagesCap,'page.php?action=edit&post='.$has_posts);
 }
 }else{
 add_submenu_page($base+$offset.'.php', __($panel->name), $new_indicator_text, $requiredPagesCap, 'page-new.php?custom-write-panel-id=' . $panel->id);
 add_submenu_page($base+$offset.'.php', __($panel->name), $edit_indicator_text, $requiredPagesCap, 'edit-pages.php?filter-posts=1&custom-write-panel-id=' . $panel->id);
 }
 }
 }

And replace it with the following:

if ($panel->type == "post"){
 if($panel->single == 1){  //if the post is single
 if($add_post){ //if the post is single and don't have any related post
 add_submenu_page('post-new.php', __($panel->name), __($panel->name), $requiredPostsCap, 'post-new.php?custom-write-panel-id=' . $panel->id);
 }   
 }else{
 add_submenu_page('post-new.php', __($panel->name), __($panel->name), $requiredPostsCap, 'post-new.php?custom-write-panel-id=' . $panel->id);
 }
 }else {
 if($panel->single == 1){ //if the page is single
 if($add_post){ //if the page is single and don't have any related post
 add_submenu_page('page-new.php', __($panel->name), __($panel->name), $requiredPagesCap, 'page-new.php?custom-write-panel-id=' . $panel->id);
 }
 }else{
 add_submenu_page('page-new.php', __($panel->name), __($panel->name), $requiredPagesCap, 'page-new.php?custom-write-panel-id=' . $panel->id);
 }
 }
 }

The replaced code above is actually a drawback to an older version of Flutter with a few adjustments. Notice that we have instructed the new post menus to be added to the submenu page of post-new.php and similarly the page menus to be added within the page-new.php. This effectively moves them under the corresponding navigation menu. The function is repeated because, in the original Flutter menu, the Custom Write Panels would duplicate in two different locations, which seemed unnecessary though we are leaving you with the ability to replace them.

Dale Crum

Dale Crum

Owner / Creative Director at Doc4 Design