使用 get_post
和 get_page
獲取單個文章或頁面的詳細資訊:
// 獲取文章或頁面的ID
$post_id = get_the_ID();
// 獲取文章或頁面的詳細資訊
$post = get_post($post_id);
// 獲取文章或頁面的標題
$title = $post->post_title;
// 獲取文章或頁面的內容
$content = $post->post_content;
// 獲取文章或頁面的ID
$post_id = get_the_ID();
// 獲取文章或頁面的詳細資訊
$post = get_post($post_id);
// 獲取文章或頁面的標題
$title = $post->post_title;
// 獲取文章或頁面的內容
$content = $post->post_content;
// 獲取文章或頁面的ID $post_id = get_the_ID(); // 獲取文章或頁面的詳細資訊 $post = get_post($post_id); // 獲取文章或頁面的標題 $title = $post->post_title; // 獲取文章或頁面的內容 $content = $post->post_content;