• Hello I have a situation where my nav is split in 2 due to the design of the layout. Basically my logo is in the middle of the page witht he main navigation split to each side (3 items on the left and 3 on the right). I like how WP makes the main navigation by default from the page items (starting with the default Kubrick theme). I would like to keep that. but make it so it constructs the first 3 items in one div element that is positioned to the left of the logo and the other 3 in the right div element. Is this possible? If so could someone point me int he direction to a tutorial and or post a snippet of code I can cut and paste? I am very new to WP and even newer to php. I am trying to learn as I go but some things just seem beyond my knowledge at this point.

    Much appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter purplepills

    (@purplepills)

    mercy bump ??

    Try this…

    <?php wp_list_pages('title_li=&sort_column=menu_order&depth=1'); ?>
    <?php
      if($post->post_parent)
      $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
      else
      $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&depth=1");
      if ($children) { ?>
      <ul>
      <?php echo $children; ?>
      </ul>
      <?php } ?>

    hi. can you tell me if this works or not?

    @purplpills idea could be done using the ‘number’ and ‘offset’ parameters of wp_list_pages(): https://codex.www.ads-software.com/Template_Tags/wp_list_pages

    number
    (integer) Sets the number of Pages to display. This causes the SQL LIMIT value to be defined. Default to no LIMIT. (This parameter was added with Version 2.8)
    offset
    (integer) The number of Pages to pass over (or displace) before collecting the set of Pages. Default is no OFFSET. (This parameter was added with Version 2.8)

    something like:

    <div id="leftsidepagenav">
    <ul><?php wp_list_pages('number=3'); ?></ul>
    </div>
    <div id="logo">...</div>
    <div id="rightsidepagenav">
    <ul><?php wp_list_pages('offset=3&number=3'); ?></ul>
    </div>

    in my experience, ‘offset’ only works in connection with ‘number’.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Split Navigation from pages’ is closed to new replies.