Removing and Adding Menu items using custom css
-
Hullo, am really new to themes. i want to change top menu items, remove the sub menu and home button using custom css. I donot want to mess with the template, Thanks
<body <?php body_class(); ?> > <div id="top_strip"> <div id="top_strip_in" class="top_strip_in"> <div class="currentmenu"><span><?php _e("Menu",'templatic'); ?></span></div> <?php if (strtolower(get_option('ptthemes_show_top_menu')) == strtolower('Yes')) { ?> <div class="menu-header"> <ul class="children"> <li class="hometab <?php if ( is_home() && @$_REQUEST['page']=='' && @$_REQUEST['ptype'] =='' ) { ?> current_page_item <?php } ?>"><a>/"><?php _e('Home','templatic'); ?></a> <li class="<?php if($page =='page'){ echo 'current-page-item';}?>" > <?php $page_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts where post_title like 'Page Templates'");?> <a>"><?php _e('Page Templates','templatic'); ?></a> <ul class="sub-menu"> <?php $page_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts where post_title like 'Page Templates'"); wp_list_pages('title_li=&post_type=page&exclude=2,'.$page_id);?> <?php global $current_user; if($current_user->ID) { ?> <li><a>ID);?>"><?php echo $current_user->display_name; ?></a></li> <li><a>" title="Log out of this account"><?php echo LOGOUT_TEXT;?></a></li> <?php } else { ?> <li><a>"><?php echo LOGIN_TEXT;?></a></li> <?php } ?> </div> <?php } else { if ( has_nav_menu( 'primary' ) ) { wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary','menu_class' => 'sub-menu childern','menu_id' => 'top-nav' )); } } ?> <?php dynamic_sidebar('header_logo_right_side'); ?> </div> </div> <div class="header-wrapper"> <div id="header"> <div class="header_left"> <?php if ( strtolower(get_option('ptthemes_show_blog_title')) == strtolower('Yes') ) { ?> <div class="blog-title"><a>/"><?php bloginfo('name'); ?></a> <p class="blog-description"><?php bloginfo('description'); ?></p> </div> <?php } else { ?> <div class="logo"> <?php st_header(); ?> </div> <?php } ?> </div> <!-- header left #end --> <div class="header-inner-right-wrapper"> <?php if( get_option('is_user_eventlist') == 'Yes' ){ ?> <a>/?ptype=post_event"><?php _e('Submit Event','templatic');?> </a> <?php }?> <?php $total_events = get_total_events_count(); if($total_events) { ?> <p class="general_statics"> <?php _e('Total Events','templatic');?> : <span><?php echo $total_events;?></span></p> <?php }?> </div> </div> </div> <?php if( is_active_sidebar('mega_menu') ){ dynamic_sidebar( 'mega_menu' ); }else{ ?> <div id="main_navi"> <div class="currentmenu2"><span><?php _e('Menu','templatic'); ?></span></div> <?php if ( get_option('ptthemes_show_menu') == 'No' ){ $nav_menu = get_option('theme_mods_events2'); wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'secondary','menu_class' => 'sub-menu menu-header', )); } else { ?> <div class="menu-header clearfix"> <ul id="menu-below-main" class="sub-menu"> <li class="hometab <?php if ( is_home() && @$_REQUEST['page']=='' && @$_REQUEST['ptype'] =='') { ?> current_page_item <?php } ?>"><a>/"><?php _e('Home','templatic'); ?></a> <?php $terms = get_terms('eventcategory'); foreach ($terms as $term) : $link = get_term_link($term->slug, 'eventcategory'); global $wp_query,$post; $current_term = $wp_query->get_queried_object(); ?> <li class="<?php if(@$current_term->name == @$term->name || @$slug == @$term->slug ){ echo 'current_page_item ';}?>"> <a>"><?php echo $term->name; ?></a> <?php endforeach; ?> <li class="<?php if(@$_REQUEST['ptype']=='blog' || @$slug =='blog'){ echo 'current_page_item ';}?>"> <?php $id1 = $wpdb->get_var("SELECT term_id FROM $wpdb->terms where name like 'Blog'"); $link1 = get_category_link( $id1 );?> <a>"><?php _e('Blog','templatic'); ?></a> <?php if (get_option('ptthemes_show_addevent_link') == 'Yes') { ?> <li class="<?php if(@$_REQUEST['ptype']=='post_event' || @$slug =='post_event'){ echo 'current_page_item'; }?>"> <a>/?ptype=post_event"><?php _e('Add Event','templatic'); ?></a> <?php } ?> <?php } } ?> </div> </div> <?php if($_REQUEST['ptype'] =='post_event' ){ ?> <script type="text/javascript" > jQuery.noConflict(); jQuery('li.menu-item-home').removeClass('current-menu-item'); </script> <?php }
Viewing 3 replies - 1 through 3 (of 3 total)
-
You cannot really remove anything with CSS but you can just not display them on your site.
For example with the menu
.currentmenu {
display: none;
}Or just use jQuery
$(‘.currentmenu’).empty();I tried it there was no change.
add !Important add the end and also make sure that your code is loaded after the other css.
.currentmenu {
display: none!important;
}But why not just create a child theme and then make the modifications there in php?
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Removing and Adding Menu items using custom css’ is closed to new replies.