Template is not defined.

5 Best WordPress Backup plugins (Pros and Cons)

<?php
    $current_post_id = get_the_ID();
    $current_post_title = get_the_title( $current_post_id );
    $current_post_parent_id = wp_get_post_parent_id( $current_post_id );
    $current_post_parent_title = get_the_title( $current_post_parent_id );
    $current_post_parent_permalink = get_permalink( $current_post_parent_id );
    $child_of = $current_post_parent_id;

    //check if a page has children 
    function page_has_child($post_id){
        $child_pages = get_pages( array(
            'child_of'=> $post_id
        ) );
        if (empty($child_pages)) {            
            return false;
        } else {
            return true;
        }
    }
   
    
    if (!$current_post_parent_id) { 
        $child_of = get_the_ID(  );
    } 

    if ($current_post_parent_id) { 
        
    ?>

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

    <?php } ?>

Table of Contents