使用 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;