I have an if statement verifying the page id using the following:
<?php if ( is_page(10) ) { ?>
How can I do something like if the page parent is 10?
try something like this
global $post; if ($post->post_parent == 10) { echo "parent id is 10"; }
Get the current page object, then get its parent id:
global $wp_query; $currentPage = get_page($wp_query->get_queried_object_id()); if (is_page($currentPage['post_parent'])) { }
$id = wp_get_post_parent_id( get_the_id() );
Now $id has parent page $id
$id