标签: 父页面链接

  • wordpress子页面获取父页面的标题和链接

    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 } ?>