The WP_Post
class has an attribute post_parent
that you can use for this.
while ($q->have_posts()) {
$q->the_post();
$post = get_post();
if (!empty($post->post_parent)) {
// do something different
}
}
The WP_Post
class has an attribute post_parent
that you can use for this.
while ($q->have_posts()) {
$q->the_post();
$post = get_post();
if (!empty($post->post_parent)) {
// do something different
}
}