Advertisement
Guest User

Functions

a guest
Feb 1st, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. // Subpage Shortcode
  2. function is_child($page_id_or_slug) {
  3.     global $post;
  4.     if(!is_int($page_id_or_slug)) {
  5.         $page = get_page_by_path($page_id_or_slug);
  6.         $page_id_or_slug = $page->ID;
  7.     }
  8.     if(is_page() && $post->post_parent == $page_id_or_slug ) {
  9.             return true;
  10.     } else {
  11.             return false;
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement