By
05/13/2016   Comments Off on Conditional Statement: if the children of this parent page

View all snippets

Sometimes all you want to do is write a statement for every child of a particular parent page. Instead of listing all the ID for each child page in an array, just use this code and replace the number ID with parent ID of the child pages:

<?php if (in_array(60, $post->ancestors)): ?>
    <?php // but your statements here ?>
<?php endif; ?>