606 posts
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 5
  • Beta Tester
+8 more
designcise
says

Alright so I’ve hit the roadblock on this, maybe someone here knows how this works; I need to get the title and IDs of all the pages, including the home page (in a select box). So the code I’m working with is something like this:

$pages = get_pages(); 

foreach($pages as $page) {
    $option = '<option value="'.$page->ID.'">';
    $option .= $page->post_title;
    $option .= '</option>';
    echo $option;
}

But the home page doesn’t get included there, I tried passing argument to get_pages (with “include => 0” but that doesn’t work either. Any idea how I can add the current/set home page in the list?

Thanks!

606 posts
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 5
  • Beta Tester
+8 more
designcise
says

oh and this needs to be done on the admin side

5441 posts
  • Copyright Ninja
  • Helpful Hacker
  • Power Elite Author
  • Author Level 12
+22 more
dtbaker
Moderator
says

If you create a “home” page it should display in the list.

606 posts
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 5
  • Beta Tester
+8 more
designcise
says

I solved it some other way, I think there’s no way to get the title of the home page link from within the admin area, I’ve searched a lot. Hmm.. thanks anyway DT!

by
by
by
by
by
by