is_child() Wordpress function

function is_child($page_id_or_slug) { global $post; if(!is_int($page_id_or_slug)) { $page = get_page_by_path($page_id_or_slug); $page_id_or_slug = $page->ID; } if(is_page() && $post->post_parent == $page_id_or_slug ) { return true; } else { return false; } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.