Trying to get property of non-object when using $post->post_parent
@kaiser answer gives you the solution. I see from your comment that you don’t understand, so I upvoted his answer and translate it in code: <?php $bannerimg = ‘home.jpg’; $post = is_singular() ? get_queried_object() : false; if ( ! empty($post) && is_a($post, ‘WP_Post’) ) { if ( ‘about’ == $post->post_name || ‘2’ == $post->post_parent ) … Read more