• Hi,

    I’m struggling and hope somebody can help me.
    I have this get_pages array
    <?php $pages = get_pages(array('child_of' => 23, 'exclude' => 60)); ?>
    But instead of excluding post ID 60 I want to exlude the page I’m on at that moment.
    I know it should be something like .$post->ID but I can’t seem to get the notation right because my theme keeps breaking 🙁

    Anybody?
    Thnx in advance
    Michael

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    try it with this in page.php:

    <?php $pages = get_pages('child_of=23&exclude='.$posts->ID); ?>

    or this:

    <?php $pages = get_pages(array('child_of' => 23, 'exclude' => $posts[0]->ID)); ?>

    Thread Starter michaelhastrich

    (@michaelhastrich)

    Brilliant,
    second line does exactly what i need.
    Thanks a lot or if your dutch (which i assume from your name)
    hartstikke bedankt! 🙂

    Michael

    Moderator keesiemeijer

    (@keesiemeijer)

    No problem, graag gedaan.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘exclude the current page from query result’ is closed to new replies.