• Resolved rasmuscarlsen

    (@rasmuscarlsen)


    Greetings all!

    Just read this guide on wp_list_pages and thats great – I managed to do it! ??

    Anyway; what I need to do is dynamicly excluding a page from the list.

    Lets say I got 5 pages, alle the same (special) template and they all have the same parent – and the same (special) sidebar.

    On the sidebar I want a list of all the pages using that template and/or having the same parent – but just nok the page that is beeing viewed … I dont want the parent-page ind the list.

    Does it make sense?

    thanks

    rasmus

Viewing 2 replies - 1 through 2 (of 2 total)
  • Something like this in your sidebar.php

    <?php
    if (is_page()) {
    $page = $post->ID;
    $exclude = $page;
    wp_list_pages('title_li=<h2>Pages without the currently view page/tree</h2>&exclude_tree='.$exclude );
    }
    ?>

    Thread Starter rasmuscarlsen

    (@rasmuscarlsen)

    Yeah! Thats it. Thanks!

    ras

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Dynamic exclude a id from wp_list_pages’ is closed to new replies.