Changeset 13338
- Timestamp:
- 02/23/2010 08:22:56 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/custom-navigation.php
r13336 r13338 228 228 229 229 case 'default': 230 $templatedir = get_bloginfo('url'); 230 231 ?> 231 232 <dl> 232 233 <dt> 233 234 <?php $templatedir = get_bloginfo('url'); ?>235 234 <span class="title"><?php echo $menu_item->title; ?></span> <a onclick="appendToList('<?php echo $templatedir; ?>','<?php echo $menu_item->append; ?>','<?php echo $menu_item->title; ?>','<?php echo $menu_item->link; ?>','<?php echo $menu_item->ID; ?>','<?php echo $menu_item->parent_item ?>','<?php echo $menu_item->description; ?>')" name="<?php echo $menu_item->title; ?>" value="<?php echo $menu_item->link; ?>"><img alt="<?php esc_attr_e('Add to Custom Menu'); ?>" title="<?php esc_attr_e('Add to Custom Menu'); ?>" src="<?php echo admin_url('images/ico-add.png'); ?>" /></a> </dt> 236 235 </dl> … … 334 333 // Display Loop 335 334 foreach ( $pages_array as $post ) { 336 if ( $post->post_parent == 0) {337 // Custom Menu335 if ( $post->post_parent == 0 ) { 336 $post = setup_menu_item($post, 'page', $intCounter); 338 337 if ( $type == 'menu' ) { 339 $post = setup_menu_item($post, 'page', $intCounter);340 338 ?> 341 339 342 340 <li id="menu-<?php echo $intCounter; ?>" value="<?php echo $intCounter; ?>"> 343 344 <?php output_menu_item($post, 'menu', $intCounter); ?>345 346 <?php $parentli = $post->ID; ?>347 <?php $intCounter++; ?>348 341 <?php 349 350 //Recursive function 342 output_menu_item($post, 'menu', $intCounter); 343 $parentli = $post->ID; 344 $intCounter++; 351 345 $intCounter = wp_custom_navigation_default_sub_items($post->ID, $intCounter, $parentli, 'pages', 'menu'); 352 353 346 ?> 354 355 347 </li> 356 348 357 349 <?php 358 359 350 } elseif ( $type == 'default' ) { 360 351 // Sidebar Menu 361 352 ?> 362 363 353 <li> 364 <dl>365 <dt>366 354 <?php 367 $post_text = htmlentities($post->post_title); 368 $post_url = get_permalink($post->ID); 369 $post_id = $post->ID; 370 $post_parent_id = $post->post_parent; 371 372 $description = htmlentities(get_post_meta($post_id, 'page-description', true)); 373 374 ?> 375 <?php $templatedir = get_bloginfo('url'); ?> 376 377 <span class="title"><?php echo $post->post_title; ?></span> <a onclick="appendToList('<?php echo $templatedir; ?>','Page','<?php echo $post_text; ?>','<?php echo $post_url; ?>','<?php echo $post_id; ?>','<?php echo $post_parent_id ?>','<?php echo $description; ?>')" name="<?php echo $post_text; ?>" value="<?php echo get_permalink($post->ID); ?>"><img alt="Add to Custom Menu" title="Add to Custom Menu" src="<?php echo get_bloginfo('url'); ?>/wp-admin/images/ico-add.png" /></a></dt> 378 </dl> 379 <?php $parentli = $post->ID; ?> 380 <?php $intCounter++; ?> 381 <?php 382 383 //Recursive function 384 $intCounter = wp_custom_navigation_default_sub_items($post_id, $intCounter, $parentli, 'pages', 'default'); 385 355 output_menu_item($post, 'default'); 356 $parentli = $post->ID; 357 $intCounter++; 358 $intCounter = wp_custom_navigation_default_sub_items($post->ID, $intCounter, $parentli, 'pages', 'default'); 386 359 ?> 387 388 360 </li> 389 361 390 362 <?php 391 392 363 } 393 364 } … … 419 390 420 391 if ( !$categories_array ) { 421 echo 'Not Found';392 _e('Not Found'); 422 393 return $intCounter; 423 394 } … … 432 403 433 404 <li id="menu-<?php echo $intCounter; ?>" value="<?php echo $intCounter; ?>"> 434 <?php output_menu_item($cat_item, 'menu'); ?>435 <?php $parentli = $cat_item->cat_ID; ?>436 <?php $intCounter++; ?>437 405 <?php 438 439 // Recursive function440 $intCounter = wp_custom_navigation_default_sub_items($cat_item->cat_ID, $intCounter, $parentli, 'categories','menu');441 406 output_menu_item($cat_item, 'menu'); 407 $parentli = $cat_item->cat_ID; 408 $intCounter++; 409 $intCounter = wp_custom_navigation_default_sub_items($cat_item->cat_ID, $intCounter, $parentli, 'categories', 'menu'); 442 410 ?> 443 411 … … 449 417 ?> 450 418 <li> 451 <dl>452 <dt>453 419 <?php 454 $post_text = htmlentities($cat_item->cat_name); 455 $post_url = get_category_link($cat_item->cat_ID); 456 $post_id = $cat_item->cat_ID; 457 $post_parent_id = $cat_item->parent; 458 $description = htmlentities(strip_tags($cat_item->description)); 459 ?> 460 <?php $templatedir = get_bloginfo('url'); ?> 461 <span class="title"><?php echo esc_html($cat_item->cat_name); ?></span> <a onclick="appendToList('<?php echo $templatedir; ?>','Category','<?php echo $post_text; ?>','<?php echo $post_url; ?>','<?php echo $post_id; ?>','<?php echo $post_parent_id ?>','<?php echo $description; ?>')" name="<?php echo $post_text; ?>" value="<?php echo $post_url; ?>"><img alt="="<?php esc_attr_e('Add to Custom Menu'); ?>" title="="<?php esc_attr_e('Add to Custom Menu'); ?>" src="<?php echo admin_url('images/ico-add.png'); ?>" /></a> </dt> 462 </dl> 463 <?php $parentli = $cat_item->cat_ID; ?> 464 <?php $intCounter++; ?> 465 <?php 466 // Recursive function 420 output_menu_item($cat_item, 'default'); 421 $parentli = $cat_item->cat_ID; 422 $intCounter++; 467 423 $intCounter = wp_custom_navigation_default_sub_items($cat_item->cat_ID, $intCounter, $parentli, 'categories', 'default'); 468 424 ?> … … 518 474 // Display Loop 519 475 foreach ( $sub_array as $sub_item ) { 520 // Prepare Menu Data521 476 $sub_item = setup_menu_item($sub_item, $item_type, $counter); 522 477 523 if ( $type == 'categories' ) {524 // Category Menu Item525 $link = get_category_link($sub_item->cat_ID);526 $title = htmlentities($sub_item->cat_name);527 $parent_id = $sub_item->cat_ID;528 $itemid = $sub_item->cat_ID;529 $linktype = 'category';530 $appendtype = 'Category';531 $description = htmlentities(strip_tags($sub_item->description));532 } elseif ( $type == 'pages' ) {533 //Page Menu Item534 $link = get_permalink($sub_item->ID);535 $title = htmlentities($sub_item->post_title);536 $parent_id = $sub_item->ID;537 $linktype = 'page';538 $itemid = $sub_item->ID;539 $appendtype = 'Page';540 $description = htmlentities(get_post_meta($itemid, 'page-description', true));541 } else {542 // Custom Menu Item543 $title = '';544 $linktype = 'custom';545 $appendtype= 'Custom';546 }547 548 // Custom Menu549 478 if ( $output_type == 'menu' ) { 550 479 ?> 551 480 <li id="menu-<?php echo $counter; ?>" value="<?php echo $counter; ?>"> 552 <?php output_menu_item($sub_item, 'menu'); ?>553 <?php $counter++; ?>554 481 <?php 555 556 // Do recursion 557 $counter = wp_custom_navigation_default_sub_items($parent_id, $counter, $parent_id, $type, 'menu'); 558 482 output_menu_item($sub_item, 'menu'); 483 $counter++; 484 $counter = wp_custom_navigation_default_sub_items($sub_item->ID, $counter, $sub_item->ID, $type, 'menu'); 559 485 ?> 560 486 561 487 </li> 562 488 <?php 563 } elseif ( $output_type == 'default') {489 } elseif ( $output_type == 'default' ) { 564 490 // Sidebar Menu 565 491 ?> 566 492 <li> 567 <dl>568 <dt>569 570 <?php $templatedir = get_bloginfo('url'); ?>571 <span class="title"><?php echo $title; ?></span> <a onclick="appendToList('<?php echo $templatedir; ?>','<?php echo $appendtype; ?>','<?php echo $title; ?>','<?php echo $link; ?>','<?php echo $itemid; ?>','<?php echo $parent_id ?>','<?php echo $description; ?>')" name="<?php echo $title; ?>" value="<?php echo $link; ?>"><img alt="<?php esc_attr_e('Add to Custom Menu'); ?>" title="<?php esc_attr_e('Add to Custom Menu'); ?>" src="<?php echo admin_url('images/ico-add.png'); ?>" /></a> </dt>572 </dl>573 493 <?php 574 575 // Do recursion 576 $counter = wp_custom_navigation_default_sub_items($itemid, $counter, $parent_id, $type, 'default'); 577 494 output_menu_item($sub_item, 'default'); 495 //$counter++; 496 $counter = wp_custom_navigation_default_sub_items($sub_item->ID, $counter, $sub_item->ID, $type, 'default'); 578 497 ?> 579 498 </li> … … 581 500 <?php 582 501 } 583 584 502 } 585 503 ?>
Note: See TracChangeset
for help on using the changeset viewer.