Articles
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 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 Wrte 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 within 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.
David,
Thanks for adding this feature! I’ve been looking for something like this built in to a plug-in for awhile. I’m definitely going to be switching to Magic Fields. Congrats Doc4!
David,
This is fantastic news, I have been trying for years to get the Flutter team on board with this to no avail. Thank you.
Hey Doc4
I just add this code in the Magic Fields plugin (http://bit.ly/TSK39) i just wanna say thanks for this
(i will give credit to you in next release)
David.
David,
I have sent a new RCCWP_Menu.php file your way, let us know if this doesn’t work. For those reading this: the issue appears to be the way the code was copied from the browser window. The copied code added ascii spaces (
) which corrupted it. Please be sure to use the rollover “view source” when selecting the code.When I tried replacing this code, wordpress just stopped loading completely in the browser. I double checked over and over again to make sure I was replacing the right lines of code.
Not sure why this isn’t working.
I hate having tons of extra buttons on the Admin Panel for each custom write panel I make.
Any thoughts?
Marko,
I’ve sent a modified RCCWP_Menu.php file over. Please let us know if this works.
Thank you
Very nice. I use a lot of Writepanels, so condensing them is useful
However, when i modify the php file like you suggested, the write panels are shown in the Posts section, like they should. But, each write panel is still listed in the main menu as well, and they lead to an Object Not Found error. Do i need to modify something else as well?
Thanks guys, good stuff!