• Resolved steve02a

    (@steve02a)


    I am using permalinks setting Post Name. So, if I have page called sample, the url would be: https://www.domainname.com/sample/

    How do I get the page ID for my page called sample?

    I know how to get ID’s for posts, but on my site, I do not use any posts. The site is all pages. I need to get ID’s for all these crazy xml sitemap plugins that allow you to exclude pages/posts, but only based on an ID #, which I have no idea is for pages only.

    Thank you in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi

    (@esmi)

    Thread Starter steve02a

    (@steve02a)

    Esmi…thanks for the link.

    How do you use function references though? I’ve never heard of this stuff before…

    Thread Starter steve02a

    (@steve02a)

    Actually, I just found a plugin that would give me all the ID’s…Thanks for the function ref stuff though…

    esmi

    (@esmi)

    It’s not a function reference. It’s just a function – in the same way that wp_list_pages (which you may have come across) is a function. In each case, you need to look at:
    – what the function does
    – what it returns
    – how you use it (syntax, parameters etc.)

    In this particular case, adding something like:

    <?php $my_pages = get_all_page_ids();
    echo '<pre>';
    print_r($my_pages);
    echo '</pre>'; ?>

    to just about any template file (outside of the Loop) will dump a list of page ids to the generated page.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how do you get page ID's?’ is closed to new replies.