If Current Page Has Child Page

            <?php 
                //echo get_the_ID();
                //echo wp_get_post_parent_id(get_the_ID());

                if(wp_get_post_parent_id(get_the_ID())){
                    echo "Im a child page";
                }

            ?>

IF get_the_ID() = 0 = FALSE

IF get_the_ID() >= 1 = TRUE

wp_get_post_parent_id(get_the_ID()) this is comparing in the if statement
            <?php 
                //echo get_the_ID();
                //echo wp_get_post_parent_id(get_the_ID());

                $theParent = wp_get_post_parent_id(get_the_ID());

                if ($theParent) { ?>

                <div class="metabox metabox--position-up metabox--with-home-link">
                    <p>
                    <a class="metabox__blog-home-link" href="<?php echo get_permalink($theParent); ?>">
                        <i class="fa fa-home" aria-hidden="true"></i> Back to <?php echo get_the_title($theParent); ?>
                    </a> 
                    <span class="metabox__main"><?php the_title(); ?></span>
                    </p>
                </div>

                <?php }
            ?>
Scroll to Top