我有一个登录页,可以从中提取其子项的摘录、标题和缩略图。它可以工作,除了标题(即页面标题)链接在其创建的url中加倍父文件夹之外。比如:www.site。com/餐厅/餐厅/麦当劳。我对PHP不太在行,我不明白为什么它会在标题而不是缩略图上加倍。我如何才能将其更改为只拉入父级一次?
if ( is_page( \'restaurants\' ) ) {
$pageChildren = get_pages( array( \'child_of\' => $post->ID, \'sort_column\' => \'menu_order\', \'hierarchical\' => \'0\', \'exclude\' => \'1453\' ) );
if ( $pageChildren ) {
foreach ( $pageChildren as $pageChild ) {
echo \'<div class="restaurant-landing"><h2><a href="\' . get_page_uri($pageChild) .\'">\' . $pageChild->post_title . get_the_post_thumbnail($pageChild->ID).\'</a></h2>\';
if ($pageChild->post_excerpt){
echo \'<p>\'.$pageChild->post_excerpt.\'</p></div>\';
}
}
}
}