簡體   English   中英

在Wordpress主頁中顯示子頁面,並帶有縮略圖,標題和頁面限制

[英]Display child pages in Wordpress home page with thumbnail, title and page limit

我試圖在子頁面上顯示縮略圖,標題和頁面限制 ,但我不知道該如何編碼。 請幫我解決它。

<?php
$ancestor_id=29;
$nbpages = 2;
$pagesd = wp_list_pages(array(
"child_of" => $ancestor_id,
"include" => $incl,
"link_before" => "",
"title_li" => "",
"sort_column" =>
"menu_order"));
?>

一起去吧。 應該起作用:1.檢索具有父$ ancestor_id的所有頁面。2.循環瀏覽結果並回顯頁面標題和縮略圖。

 $ancestor_id = 29;
 $pg_args = array(
    'sort_order' => 'asc',
    'sort_column' => 'post_title',
    'hierarchical' => 1,
    'exclude' => '',
    'include' => '',
    'meta_key' => '',
    'meta_value' => '',
    'authors' => '',
    'child_of' => 0,
    'parent' => $ancestor_id,
    'exclude_tree' => '',
    'number' => '',
    'offset' => 0,
    'post_type' => 'page',
    'post_status' => 'publish'
);
$pages = get_pages($pg_args);

    foreach($pages as $page){
        echo $page->post_title;
        echo get_the_post_thumbnail($page);
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM