[wp-trac] [WordPress Trac] #16672: Admin Bar and param href = FALSE

WordPress Trac wp-trac at lists.automattic.com
Sat Feb 26 00:21:52 UTC 2011


#16672: Admin Bar and param href = FALSE
--------------------------+-----------------------------
 Reporter:  Bueltge       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.1
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------------
 Current i dont find an solution to add an element in the admin bar with a
 a-tag inside the li-tag. But the function add_menu has an param href and
 is also possible to add the value false, but the a-tag ist always visible


 maybe a fix on wp-includes/class-wp-admin-bar.php

 {{{
         /* Helpers */
         function recursive_render( $id, &$menu_item ) { ?>
                 <?php
                 $is_parent =  ! empty( $menu_item['children'] );

                 $menuclass = $is_parent ? 'menupop' : '';
                 if ( ! empty( $menu_item['meta']['class'] ) )
                         $menuclass .= ' ' . $menu_item['meta']['class'];
                 ?>

                 <li id="<?php echo esc_attr( "wp-admin-bar-$id" ); ?>"
 class="<?php echo esc_attr( $menuclass ); ?>"><?php
                         if ( ! empty( $menu_item['href'] ) ) : ?>
                                 <a href="<?php echo esc_url(
 $menu_item['href'] ) ?>"<?php
                                         if ( ! empty(
 $menu_item['meta']['onclick'] ) ) :
                                                 ?> onclick="<?php echo
 esc_js( $menu_item['meta']['onclick'] ); ?>"<?php
                                         endif;

                                 if ( ! empty( $menu_item['meta']['target']
 ) ) :
                                         ?> target="<?php echo esc_attr(
 $menu_item['meta']['target'] ); ?>"<?php
                                 endif;
                                 if ( ! empty( $menu_item['meta']['title']
 ) ) :
                                         ?> title="<?php echo esc_attr(
 $menu_item['meta']['title'] ); ?>"<?php
                                 endif;

                                 ?>><?php
                         endif;

                         if ( $is_parent ) :
                                 ?><span><?php
                         endif;

                         echo $menu_item['title'];

                         if ( $is_parent ) :
                                 ?></span><?php
                         endif;

                         if ( ! empty( $menu_item['href'] ) ) : ?></a><?php
 endif; ?>

                         <?php if ( $is_parent ) : ?>
                         <ul>
                                 <?php foreach ( $menu_item['children'] as
 $child_id => $child_menu_item ) : ?>
                                         <?php $this->recursive_render(
 $child_id, $child_menu_item ); ?>
                                 <?php endforeach; ?>
                         </ul>
                         <?php endif; ?>

                         <?php if ( ! empty( $menu_item['meta']['html'] ) )
 : ?>
                                 <?php echo $menu_item['meta']['html']; ?>
                         <?php endif; ?>
                 </li><?php
         }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16672>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list