0

我正在设计单页布局,因此我使用此代码使子页面显示在其父页面上;

<?php
$mypages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date',     'sort_order' => 'desc' ) );

foreach( $mypages as $page ) {
    $content = $page->post_content;
    if ( ! $content ) // Check for empty page
        continue;

    $content = apply_filters( 'the_content', $content );
?>
    <h2><?php echo $page->post_title; ?></h2>
    <div class="entry"><?php echo $content; ?></div>
<?php
}
?>

我想在顶部添加链接到每个子页面的图标。但我不知道如何锚定子页面标题。如果可能的话,我想在没有插件的情况下做到这一点。

我真的很感谢你的帮助。

4

1 回答 1

0

获得永久链接 SRC$link = get_permalink($page->ID);

于 2013-11-02T22:39:17.613 回答