打開自定義-主頁設置,包括如下內容:
您可以選擇在您站點的主頁上顯示什麼。可以是按時間降序排列的文章(傳統博客),也可以是固定/靜態頁面。要設置靜態主頁,您需要創建兩個頁面,其中一個會變成主頁,而另一個將會顯示您的文章。
包括如下選項:
1、您的最新文章(默認)
2、一個靜態頁面
1)主頁
2)文章頁
說明:
『show_on_front』: 對應「主頁設置–您的主頁顯示」:
返回值:
Data type: String:
「 posts 」 : 對應 「 您的最新文章 」(默認)
「 page 」 : 對應「 一個靜態頁面 」
如果選擇了「 一個靜態頁面 」,則:
「 page_on_front 」: Data type: Integer
The ID of the page that should be displayed on the front page.
「 page_for_posts 」 : Data type: Integer
The ID of the page that displays posts. Data type: Integer
舉例說明:
if ( 'posts' == get_option( 'show_on_front' ) )
{ include( get_home_template() ); }