595 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+5 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!

595 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+5 more
designcise says

oh and this needs to be done on the admin side

3180 posts
  • Helps us moderate the forums
  • Has been part of the Envato Community for over 5 years
  • Helped several times protecting Envato Market against copyright violations
  • Won a competition
+15 more
dtbaker Moderator says

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

595 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+5 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