wordpress模板制作時,如果wordpress子頁面模板獲取父頁面的標題和鏈接,用以下代碼就可以現實。

<?php global $post;
  if ( $post->post_parent ) { ?>
    <a href="<?php echo get_permalink( $post->post_parent ); ?>" >
    <?php echo get_the_title( $post->post_parent ); ?>
    </a>
<?php } ?>