Posted By

levinet on 09/03/10


Tagged

get php page wordpress structure Parent


Versions (?)

WordPress - Get Current Page Parent


 / Published in: PHP
 

Returns the page object of the parent of the current page.

  1. function get_parent_page() {
  2. global $post;
  3. $topParent = $post;
  4. while ($topParent->post_parent) {
  5. $topParent = $topParent->post_parent;
  6. }
  7. return get_page($topParent);
  8. }

Report this snippet  

You need to login to post a comment.