• Hi !

    I’m trying make a highlithed menu on website http://www.milionerumyslu.pl
    It almost works :
    After the first click on menu , but on start its not highlighted .

    I’ve been trying something like this :

    <?php if(is_home()){ echo ‘ class=”current_page_item” ‘;} ?>

    but it didnt work. Here is the code , i think it’s the right one , becouse i’m editing theme , not making my own menu 😉

    <li  id="menu-item-<?php echo $item_id; ?>" class=" 
    
               <?php echo implode(' ', $classes); ?>   ">
    
                <dl class="menu-item-bar">
    
                    <dt class="menu-item-handle">
    
                        <span class="item-title"><?php echo esc_html( $defaultTitle ); ?></span>
    
                        <span class="item-controls">
    
                            <span class="item-type"><?php echo esc_html( $item->type_label ); ?></span>
    
                            <span class="item-order">
    
                                <a href="<?php
    
                                    echo wp_nonce_url(
    
                                        add_query_arg(
    
                                            array(
    
                                                'action' => 'move-up-menu-item',
    
                                                'menu-item' => $item_id,
    
                                            ),
    
                                            remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) )
    
                                        ),
    
                                        'move-menu_item'
    
                                    );
    
                                ?>" class="item-move-up"><abbr title="<?php esc_attr_e('Move up'); ?>">↑</abbr></a>
    
                                |
    
                                <a href="<?php
    
                                    echo wp_nonce_url(
    
                                        add_query_arg(
    
                                            array(
    
                                                'action' => 'move-down-menu-item',
    
                                                'menu-item' => $item_id,
    
                                            ),
    
                                            remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) )
    
                                        ),
    
                                        'move-menu_item'
    
                                    );
    
                                ?>" class="item-move-down"><abbr title="<?php esc_attr_e('Move down'); ?>">↓</abbr></a>
    
                            </span>
    
                            <a class="item-edit" id="edit-<?php echo $item_id; ?>" title="<?php _e('Edit Menu Item'); ?>" href="<?php
    
                                echo ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? admin_url( 'nav-menus.php' ) : add_query_arg( 'edit-menu-item', $item_id, remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) ) );
    
                            ?>"><?php _e( 'Edit Menu Item' ); ?></a>
    
                        </span>
    
                    </dt>
    
                </dl>
  • The topic ‘highlight the home pagr’ is closed to new replies.