首页
学习
活动
专区
圈层
工具
发布

WordPress 函数:get_post() 获取指定 ID 文章相关信息

wordpress主题制作中可能需要单独调用指定文章的标题、链接或内容等,可以通过get_post()函数指定文章ID来获取文章标题、文章内容、文章链接、时间等文章相关信息。...get_post()函数用法: get_post( $post_id, $output );?> 参数说明: $post_id:文章ID。...array of field names to values(返回字段名称关联数组);ARRAY_N – returns a numeric array of field values(返回数字数组) get_post...php // 获取文章ID编号为10的标题名称,返回对象数据格式 $post_id = 100; // 文章ID echo get_post( $post_id )->post_content...php // 获取文章ID编号为10的标题名称,返回字段关联数组数据格式 $post_id = 100; $post = get_post($post_id, ARRAY_A);

91230
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到
    领券