wordpress split nav
- Started
- Last post
- 13 Responses
- forcetwelve
anyone know how this split nav can be achieved in wordpress?
- airey0
they've got:
<li class="right ">
for the 3 tight-hand nav items.
- airey0
here's the nav:
<ul id="mainnav" class="clear">
<li class="right "><a href="/english/contact/contact.html">contact</a></li>
<li class="right "><a href="/english/gallery/gallery.html">gallery</a></li>
<li class="right "><a href="/english/restaurant/restaurant.html">restaurant</a></li>
<li class="selected"><a href="/english/home/home.html">home</a></li>
<li ><a href="/english/location/location.html">location</a></li>
<li ><a href="/english/hotel/hotel.html">hotel</a></li>
</ul>
- airey0
it's hard coded into the nav so it's not something wordpress could manage without you editing the nav items in the php editing area.
- snap!forcetwelve
- i can manage the php - i just need to know where to start.forcetwelve
- forcetwelve0
right – but how do i achieve that in wordpress? will i have to hard code the nav?
- airey0
yep. basically it means that it's a fixed main navigation, so now new main pages within wordpress. i'm guessing it's setup to allow subnav pages to use a secondary nav panel - or at least could be easily enough using the page IDs.
- forcetwelve0
<?php wp_list_pages('title_li=&sort_column=menu_order&depth=1'); ?>
<?php
if($post->post_parent)
$children = wp_list_pages("title_li=&child_o...
else
$children = wp_list_pages("title_li=&child_o...
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>
- airey0
no idea. you'd need to look into a loop calling in the nav items by ID possibly and then assigning an id to the nav UL. it may be 2 separate loops calling in a 3 item UL for left and right nav. it would look the same. still, i'm clueless with this stuff sorry.
- acescence0
give each of your pages a custom field called "menu-position" or something, and a value of left or right.
look at the wp_list_pages function in the WP codex, there are a bunch of arguments you can pass it, one being meta key and value.
http://codex.wordpress.org/Templ…
put a wp_list_pages call in your template, selecting all the pages with meta key "menu-position" and meta value "right", then make a second wp_list_pages call grabbing just the ones with the "left" meta value.
- forcetwelve0
legend. thx mate. i'll look into it.
- welded0
Why not just print that 'menu-position' as the LI class instead of wasting effort on two basically identical calls?
- acescence0
there's more effort in getting that meta value printed in the li class than to just make one additional wp_list_pages call.
- bulletfactory0
the custom field is where it's at - allow a class name to take the dynamic custom field. you could then have any number of keywords to use in the field, in which its position is controlled via CSS.