Ticket #16050: menu_page+submenu_page-hooks.diff
| File menu_page+submenu_page-hooks.diff, 2.6 KB (added by , 15 years ago) |
|---|
-
wp-content/themes/twentyten/functions.php
499 499 ); 500 500 } 501 501 endif; 502 503 add_filter('menu_page','my_menu_page',10,3); 504 add_filter('submenu_page','my_menu_page',10,5); 505 function my_menu_page( $html, $item, $key, $item2 = null, $key2 = null ) { 506 return $html; 507 } -
wp-admin/menu-header.php
95 95 $menu_file = substr($menu_file, 0, $pos); 96 96 if ( ('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR . "/$menu_file") || !empty($menu_hook) ) { 97 97 $admin_is_parent = true; 98 echo "\n\t<div class='wp-menu-image'><a href='admin.php?page={$item[2]}'>$img</a></div>$toggle<a href='admin.php?page={$item[2]}'$class$tabindex>{$item[0]}</a>";98 $page = "admin.php?page={$item[2]}"; 99 99 } else { 100 echo "\n\t<div class='wp-menu-image'><a href='{$item[2]}'>$img</a></div>$toggle<a href='{$item[2]}'$class$tabindex>{$item[0]}</a>";100 $page = $item[2]; 101 101 } 102 echo apply_filters( 'menu_page', "\n\t<div class='wp-menu-image'><a href='{$page}'>$img</a></div>$toggle<a href='{$page}'$class$tabindex>{$item[0]}</a>", $item, $key ); 102 103 } 103 104 104 105 if ( !empty($submenu[$item[2]]) ) { … … 146 147 if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/$sub_file") ) || ! empty($menu_hook) ) { 147 148 // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir 148 149 if ( (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}")) || file_exists($menu_file) ) 149 $ sub_item_url = add_query_arg( array('page' => $sub_item[2]), $item[2] );150 $page = $item[2]; 150 151 else 151 $sub_item_url = add_query_arg( array('page' => $sub_item[2]), 'admin.php' ); 152 $sub_item_url = esc_url($sub_item_url); 153 echo "<li$class><a href='$sub_item_url'$class$tabindex>$title</a></li>"; 152 $page = 'admin.php'; 153 $sub_item_url = esc_url( add_query_arg( array('page' => $sub_item[2]), $page ) ); 154 154 } else { 155 echo "<li$class><a href='{$sub_item[2]}'$class$tabindex>$title</a></li>";155 $sub_item_url = $sub_item[2]; 156 156 } 157 echo apply_filters( 'submenu_page', "<li$class><a href='$sub_item_url'$class$tabindex>$title</a></li>", $sub_item, $sub_key, $item, $key ); 157 158 } 158 159 echo "</ul></div>"; 159 160 }