froggyfrog
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Linking to imagesHi there,
If you add this bit of code before your images/imagename.jpg then that will link to the images folder for your current active theme.
<?php bloginfo(‘template_directory’); ?>
Forum: Fixing WordPress
In reply to: menu with submenuBasically there is a subnav for some of the mainnav items but not all of them.
When the user selects an option with a subnav I want that subnav to show. If the user selects another option on the mainnav then I need the subnav to not show.
If you look at this site http://www.claireprice.com. Thats how I need my nav to work. If you click on the Advanced treatments option a subnav appears. If you select Job opportunities then the subnav for the advanced treatments gets hidden.
Does this help you understand what I’m after?
Thank you
Forum: Fixing WordPress
In reply to: menu with submenuHi there, thanks for your help. Z-index just layers items and visibility will just hide the menu.
I need some kind of jquery script to check if the active menu item has a subnav and if yes to show that subnav. The hide the subnav once another menu item is selected.
Any ideas?
I have this so far:-
$(function(){ $('ul.subnav').hide(); $('ul.mainnav a#active').mouseover(function(){ $('ul.subnav').show(); return false; }); });It doesn’t quite work how I want it to tho.
Any ideas?
Forum: Fixing WordPress
In reply to: show/hide submenuThe code:-
<?php // Get top level parent for page if ($post->post_parent) { $ancestors=get_post_ancestors($post->ID); $root=count($ancestors)-1; $topParent = $ancestors[$root]; } else { $topParent = $post->ID; } // This function gets the main nav items $args = array ( 'sort_column' => 'ID', 'parent' => 0, ); $mainNavItems = get_pages($args); ?> <script type="text/javascript"> // For: http://www.webdeveloper.com/forum/showthread.php?t=239126 function toggleID(IDS) { var sel = document.getElementById(IDS); sel.style.display = (sel.style.display != 'block') ? 'block' : 'none'; } </script> <body> <div id="wrapper"> <?php // Get current URL $url = $_SERVER['PHP_SELF']; ?> <div class="leftbar"> <div class="logo"></div> <ul class="mainnav"> <?php foreach($mainNavItems as $link) { // For each main nav item, check against current page ID. If matches attach 'active' to that list item $active = ''; if ($link->ID == $topParent) {$active = ' id="active"';} // Get all subpages of current main nav item $args = array ( 'sort_column' => 'menu_order', 'child_of' => $link->ID, 'parent' => $link->ID ); $subNavItems = get_pages($args); ?> <li><a class="slide" <?php echo $active; ?> href="<?php echo get_page_link($link->ID); ?>"><?php echo $link->post_title; ?></a> <?php // This line checks if there are any subpages for this main nav item if (count($subNavItems)) { ?> <ul class="subnav" id="sub1" style="display:none"> <?php $i=0; foreach($subNavItems as $subpage) { // This just adds a class to the first subnav item $first = ''; if ($i == 0) {$first = ' class="first"';} // Get all subpages of current nav item $args = array ( 'sort_column' => 'menu_order', 'child_of' => $subpage->ID, 'parent' => $subpage->ID ); ?> <li<?php echo $first; ?>><a href="<?php echo get_page_link($subpage->ID); ?>"<?php echo $class; ?>><?php echo $subpage->post_title; ?></a> <?php } ?> </ul> <?php } ?> </li> <?php }?> </ul> </div>