目次
functions.php
<h3>functions.php</h3>
function page_is_ancestor_of($slug){
global $post;
$page = get_page_by_path($slug);
$result = false;
if(isset($page)){
foreach ($post->ancestors as $ancestor) {
if($ancestor == $page->ID){ $result = true; }
}
}
return $result;
}
コメント