• Hi,

    i want to make a custom menu. I search a bit on the internet but i can’t get i right. I want to have the pages in another DIV then the subpages of the selected page. (see a drawing of the problem)

    I know there is a solution, but i can’t find it.

    Pls Help.

    With regard,
    Bas

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can do the top level parent pages with a template tag just set the depth to 1.

    But if you want to have a menu of children pages, the logic is a bit complicated to make sure it loads the right children on the right pages, luckily there are some good plugins for this. I like the Simple Section Navigation Widget plugin.

    Thread Starter baszer

    (@baszer)

    i looked allready there. But i can’t find the right line to implent.

    You can implement this by following some easy steps.
    1) Parent page listing
    You need to call “wp_list_pages” function with depth 1, so it will display only parent pages
    wp_list_pages(‘depth=1’)
    OR
    You can also call parent pages like this.
    $cdefaults = array(
    ‘child_of’ => 0, ‘sort_order’ => ‘ASC’,
    ‘sort_column’ => ‘post_title’, ‘hierarchical’ => -1,
    ‘exclude’ => ”, ‘include’ => ”,
    ‘meta_key’ => ”, ‘meta_value’ => ”,
    ‘authors’ => ”, ‘parent’ => 0, ‘sort_column’ => ‘menu_order, post_title’, ‘exclude_tree’ => ”,
    ‘number’ => ”, ‘offset’ => 0
    );
    $PagesList = get_pages($cdefaults);
    foreach ( $PagesList as $ParentPages ) {
    // Your html code here
    ‘<li ” class=”‘ . $css_class . ‘”>ID) . ‘” ‘.$NewWindow.’ title=”‘ . esc_attr(apply_filters(‘the_title’, $ParentPages->post_title)) . ‘”>‘;
    }

    2) Child page listing
    You need to call like this, here $post->ID is the current page id.

      <?php wp_list_pages( ‘title_li=&child_of=’ . get_root_page($post->ID) ); ?>

    You can also implement secoond option same as above. You just need to change “child_of” and “parent” parameter.

    I hope this will help you, to implement your requirement.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘A Page and Subpage question’ is closed to new replies.