Changeset 896362
- Timestamp:
- 04/17/2014 03:27:35 PM (12 years ago)
- Location:
- menu-override/trunk
- Files:
-
- 2 edited
-
MenuOverride.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
menu-override/trunk/MenuOverride.php
r845387 r896362 36 36 { 37 37 global $post; 38 // $post is global, re-setting this variable creates havoc.. we'll use our own 39 $_post = $post; 40 38 41 if($args['theme_location'] == ''){ 39 42 return $args; 40 43 } 41 $menuOverrideSelection = get_post_meta($post->ID,'menuOverrideSelection',true); 44 45 // if the current page is the page_for_posts, use the page and not the last post 46 if(is_home(get_option('page_for_posts'))){ 47 $_post = get_post(get_option('page_for_posts')); 48 } 49 50 $menuOverrideSelection = get_post_meta($_post->ID,'menuOverrideSelection',true); 42 51 43 52 if(is_array($menuOverrideSelection) && in_array($args['theme_location'],array_keys($menuOverrideSelection))){ … … 46 55 $levels = 0; 47 56 while($current == "PARENT" && $levels < 5){ 48 $ post = get_post($post->post_parent);49 $menuOverrideSelection = get_post_meta($ post->ID,'menuOverrideSelection',true);57 $_post = get_post($_post->post_parent); 58 $menuOverrideSelection = get_post_meta($_post->ID,'menuOverrideSelection',true); 50 59 if(in_array($args['theme_location'],array_keys($menuOverrideSelection))){ 51 60 $current = $menuOverrideSelection[$args['theme_location']]; -
menu-override/trunk/readme.txt
r845387 r896362 3 3 Tags: menu override, custom menu, custom navigation 4 4 Requires at least: 3.5.1 5 Tested up to: 3. 8.15 Tested up to: 3.9 6 6 Stable tag: trunk 7 7 License: GPLv2 or later … … 21 21 22 22 == Changelog == 23 24 = 0.4 = 25 * Bug fixes from @cfenzo to fix issues using global $post and enabling support for overriding menu on "page_for_posts" page. 23 26 24 27 = 0.3 =
Note: See TracChangeset
for help on using the changeset viewer.