kaniosrn-j
3/2/2018 - 10:36 PM

Breadcrum

Count parent and children pages. wp_get_post_parent_id( get_the_ID() )

 <?php

  <!-- 
  ### Display brumbread only if the current page being viewd is a child page.
  -->
 <?php
  // // Get the ID of the current page
  // echo get_the_ID();

  // wp_get_post_parent_id();
  // echo wp_get_post_parent_id( get_the_ID() ); // the page will return 0, if it doesn't have a parent
  $theParent = wp_get_post_parent_id( get_the_ID() );
  \!h 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 echo the_title(); ?></span></p>
    </div>

  \!h <?php } ?>  <!-- Display brumbread only if the current page being viewd is a child page. -->
  
  <?php
  // // Get the ID of the current page
  // echo get_the_ID();

  // wp_get_post_parent_id();
  // echo wp_get_post_parent_id( get_the_ID() ); // the page will return 0, if it doesn't have a parent
  \!h $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 echo the_title(); ?></span></p>
    </div>

  \!h <?php } ?>