Changeset 537426
- Timestamp:
- 04/27/2012 06:10:45 PM (14 years ago)
- Location:
- subpage-navigation
- Files:
-
- 1 deleted
- 4 edited
- 8 copied
-
tags/1.1.1 (copied) (copied from subpage-navigation/trunk)
-
tags/1.1.1/languages (copied) (copied from subpage-navigation/trunk/languages)
-
tags/1.1.1/readme.txt (copied) (copied from subpage-navigation/trunk/readme.txt)
-
tags/1.1.1/screenshot-1.png (copied) (copied from subpage-navigation/trunk/screenshot-1.png)
-
tags/1.1.1/screenshot-2.png (copied) (copied from subpage-navigation/trunk/screenshot-2.png)
-
tags/1.1.1/subpage-navigation.css (copied) (copied from subpage-navigation/trunk/subpage-navigation.css)
-
tags/1.1.1/subpages-navigation.php (copied) (copied from subpage-navigation/trunk/subpages-navigation.php)
-
tags/1.1.1/subpages-navigation.sample.css (copied) (copied from subpage-navigation/trunk/subpages-navigation.sample.css)
-
trunk/extend-wp27.php (deleted)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/subpages-navigation-admin.js (modified) (2 diffs)
-
trunk/subpages-navigation.js (modified) (2 diffs)
-
trunk/subpages-navigation.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
subpage-navigation/trunk/readme.txt
r390019 r537426 1 1 === Subpages Navigation === 2 Contributors: oltdev, godfreykfc, enej 2 Contributors: oltdev, godfreykfc, enej, ejackisch 3 3 Tags: pages, subpages, shortcode, widget, menu, navigation, collapsible, tree, sitemap 4 4 Requires at least: 2.8 … … 58 58 == Change log == 59 59 60 = 1.2 = 61 * Added the ability to display custom nav menus 62 * [subpages] shortcode now supports the auto-expand current level feature (expand='true') and menu parameter (menu='menu name') to display a custom menu 63 * removed the ability to 64 60 65 = 1.1.1= 61 66 * bugfix: some of the js and css files were not loaded properly. -
subpage-navigation/trunk/subpages-navigation-admin.js
r218414 r537426 8 8 }); 9 9 10 $('.olt-subpages-root').live('c lick',function(){10 $('.olt-subpages-root').live('change',function(){ 11 11 var widget = $(this).parents('.widget-content:first'); 12 if($(this).val() != -1) 12 13 if($(this).val() != -1){ 13 14 $('.olt-subpages-siblings', widget).attr('disabled','disabled').css('color','#999'); 14 else 15 $('.olt-subpages-siblings', widget).removeAttr('disabled').css('color','#000'); 15 }else{ 16 $('.olt-subpages-siblings', widget).removeAttr('disabled').css('color','#000'); 17 } 16 18 }); 17 19 … … 23 25 $('.olt-subpages-nested-options', widget).attr('disabled','disabled').css('color','#999'); 24 26 }); 27 25 28 }); -
subpage-navigation/trunk/subpages-navigation.js
r218414 r537426 35 35 }); 36 36 37 38 //(for some reason trying to consolidate these 2 selectors into one is giving me problems) 39 37 40 // Expand current level (widget only) 38 41 $('.subpages-navi-widget.subpages-navi-collapsible.subpages-navi-auto-expand li.subpages-navi-current-level') … … 41 44 .end() 42 45 .find('>.hitarea').click(); 46 47 //Expand current level shortcode 48 $('.subpages-navi-shortcode.subpages-navi-collapsible.subpages-navi-auto-expand li.subpages-navi-current-level') 49 .parents('li.parent:first') 50 .find('>.hitarea').click().end() 51 .end() 52 .find('>.hitarea').click(); 53 43 54 }); -
subpage-navigation/trunk/subpages-navigation.php
r390019 r537426 4 4 * Plugin URI: http://olt.ubc.ca 5 5 * Description: Create subpages navigation menu with sidebar widgets and shortcodes. 6 * Version: 1. 1.16 * Version: 1.2 7 7 * Author: Enej Bajgoric / Godfrey Chan / Michael Ha / OLT 8 8 * Author URI: http://blogs.ubc.ca/ … … 62 62 global $post; 63 63 64 65 64 if(is_page()): 66 65 /* Extract the arguments */ 67 66 extract( $args ); 68 67 extract( $instance); 69 70 68 71 69 /* Find the root post */ 72 if($root == 0): #all pages70 if($root === '0'): #all pages 73 71 $root_id = "0"; 74 72 $pages = get_pages("sort_column=menu_order"); … … 89 87 endif; 90 88 91 else : # subpages of the current page89 elseif($root == -1): # subpages of the current page 92 90 93 91 … … 104 102 $title_link = get_permalink($post->ID); 105 103 endif; 106 107 104 else: 105 106 if(function_exists('wp_get_nav_menu_items')): 107 $pages = wp_get_nav_menu_items(substr($root,5)); 108 $using_menu=true; 109 endif; 108 110 endif; 111 112 109 113 110 114 if($top_title): … … 120 124 121 125 /* Prepare the walker */ 122 $walker = new SubpagesNavigationPageList; 126 127 //$pages = wp_get_nav_menu_items('test-menu'); $menu=true; 128 129 $walker = new SubpagesNavigationPageList($using_menu); 123 130 124 131 if(is_array($pages) && !empty($pages)): … … 184 191 $instance['top_title'] = $new_instance['top_title']; 185 192 $instance['root'] = $new_instance['root']; 193 //$instance['menu'] = $new_instance['menu']; 186 194 $instance['title_link'] = $new_instance['title_link']; 187 195 $instance['siblings'] = $new_instance['siblings']; … … 244 252 <option value="0" <?php selected($instance['root'], 0); ?>><?php _e('all pages', 'olt_subpages_navigation'); ?></option> 245 253 <option value="1" <?php selected($instance['root'], 1); ?>><?php _e('subpages of the top-level page', 'olt_subpages_navigation'); ?></option> 254 255 <?php 256 $menus = get_terms('nav_menu'); 257 if(count($menus)): 258 259 echo '<option value="" disabled="disabled">-- Custom Nav Menus--</option> \n'; 260 261 foreach($menus as $menu): 262 echo '<option value="menu_' . $menu->name . '"' . selected($instance['root'], 'menu_'.$menu->name) . '>' . $menu->name . '</option> \n'; 263 endforeach; 264 endif; 265 ?> 266 246 267 </select> 247 268 <input type="checkbox" name="<?php echo $this->get_field_name( 'siblings' ); ?>" id="<?php echo $this->get_field_id( 'siblings' ); ?>" value="true" <?php checked($instance['siblings'], "true"); ?> <?php if($instance['root'] != -1) echo $dm; ?> class="olt-subpages-siblings"/> 248 269 <label for="<?php echo $this->get_field_id( 'siblings' ); ?>" <?php if($instance['root'] != -1) echo $dm; ?> class="olt-subpages-siblings"><?php _e('and its siblings', 'olt_subpages_navigation'); ?></label> 270 249 271 </p> 250 272 … … 289 311 add_shortcode('subpages', 'subpages_navigation_shortcode'); 290 312 /* 291 * Subpage navi agtion shortcode313 * Subpage navigation shortcode 292 314 *********************************************/ 293 315 function subpages_navigation_shortcode($atts) { 294 316 global $post; 317 $using_menu=false; 295 318 extract(shortcode_atts(array( 296 319 'depth' => '0', … … 298 321 'collapsible' => 'true', 299 322 'exclusive' => 'false', 323 'expand' => 'false', 324 'menu' => '0', 300 325 ), $atts)); 301 326 302 327 // Get all subpages of the current page 303 328 $root = ($siblings == 'true')? $post->post_parent : $post->ID; 304 $pages = get_pages("child_of={$root}&sort_column=menu_order"); 305 329 if($menu): 330 $using_menu=true; 331 $pages = wp_get_nav_menu_items($menu); 332 333 else: 334 $pages = get_pages("child_of={$root}&sort_column=menu_order"); 335 endif; 336 306 337 // Prepare the walker 307 $walker = new SubpagesNavigationPageList ;308 309 $output = '<ul class="subpages-navi ';338 $walker = new SubpagesNavigationPageList($using_menu); 339 340 $output = '<ul class="subpages-navi subpages-navi-shortcode'; 310 341 if($collapsible == 'true') 311 342 $output .= ' subpages-navi-collapsible'; 312 343 if($exclusive == 'true') 313 344 $output .= ' subpages-navi-exclusive'; 345 if($expand == 'true') 346 $output .= ' subpages-navi-auto-expand'; 314 347 $output .= "\">\n"; 315 348 $output .= $walker->walk($pages, (int) $depth, array('current_level' => $post->ID)); … … 335 368 if(SUBPAGE_NAVIGATION_SCRIPT) 336 369 wp_enqueue_script('subpages-navigation', plugins_url('/subpage-navigation/subpages-navigation.js'), array('jquery')); 337 370 338 371 if(SUBPAGE_NAVIGATION_STYLE){ 339 372 if (file_exists(STYLESHEETPATH."/subpages-navigation.css") ) … … 359 392 class SubpagesNavigationPageList extends Walker { 360 393 var $tree_type = 'page'; 394 //var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); 361 395 var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); 396 var $menu; 397 398 function __construct($menu = false){ 399 400 if($menu): 401 //If we're using a menu we need to retrieve slightly different info from the object we're traversing. 402 $this->menu=true; 403 $this->db_fields['parent'] = 'menu_item_parent'; 404 endif; 405 } 362 406 363 407 function start_lvl(&$output, $depth, $args) { … … 373 417 function start_el(&$output, $page, $depth, $args) { 374 418 extract($args); 375 376 $title = esc_html($page->post_title); 377 $link = get_permalink($page->ID); 419 420 if($this->menu): 421 $title = esc_html($page->title); 422 $link = $page->url; 423 else: 424 $title = esc_html($page->post_title); 425 $link = get_permalink($page->ID); 426 endif; 427 428 378 429 379 430 $indent = str_repeat(" ", $depth)." "; 380 431 $output .= $indent."<li class=\"subpages-navi-node subpages-navi-level-$depth"; 381 if ($current_level == $page->ID) 382 $output .= ' subpages-navi-current-level'; 432 if( $this->menu ): 433 if ($current_level == $page->object_id): 434 $output .= ' subpages-navi-current-level'; 435 endif; 436 else: 437 if ($current_level == $page->ID): 438 $output .= ' subpages-navi-current-level'; 439 endif; 440 endif; 441 383 442 $output .= "\">\n"; 384 443 $output .= $indent." <a href=\"$link";
Note: See TracChangeset
for help on using the changeset viewer.