594 posts
  • Author had a File in an Envato Bundle
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 10 000 and 50 000 dollars
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!

594 posts
  • Author had a File in an Envato Bundle
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 10 000 and 50 000 dollars
designcise says

oh and this needs to be done on the admin side

2938 posts
  • Australia
  • Community Moderator
  • Elite Author
  • Author had a Free File of the Month
  • Most Wanted Bounty Winner
  • Author had a File in an Envato Bundle
  • Has been a member for 5-6 years
  • Contributed a Blog Post
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+10 more
dtbaker Volunteer moderator says

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

594 posts
  • Author had a File in an Envato Bundle
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 10 000 and 50 000 dollars
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