编辑“WordPress:WPMU Functions/get blog post

跳转至: 导航、​ 搜索
警告:您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您登录创建一个账户,您的编辑将归属于您的用户名,且将享受其他好处。

该编辑可以被撤销。 请检查下面的对比以核实您想要撤销的内容,然后发布下面的更改以完成撤销。

最后版本 您的文本
第1行: 第1行:
Get Blog Post returns an object of the requested post.
Get Blog Post returns an object of the requested post.
得到博客温州,返回查询的文章的object。
== The Function ==
== The Function ==
== 函数 ==
  function get_blog_post( $blog_id, $post_id ) {
  function get_blog_post( $blog_id, $post_id ) {
   global $wpdb;
   global $wpdb;
第17行: 第11行:
   return $post;
   return $post;
  }
  }
function get_blog_post( $blog_id, $post_id ) {
  global $wpdb;
  $key = $blog_id."-".$post_id."-blog_post";
  $post = wp_cache_get( $key, "site-options" );
  if( $post == false ) {
    $post = $wpdb->get_row( "SELECT * FROM {$wpdb->base_prefix}{$blog_id}_posts WHERE ID = '{$post_id}'" );
    wp_cache_add( $key, $post, "site-options", 120 );
  }
  return $post;
}
== The Returned Post ==
== The Returned Post ==
==已返回的文章 ==
  stdClass Object
  stdClass Object
  (
  (
第71行: 第45行:


Return to [[WordPress:WPMU_Functions]]
Return to [[WordPress:WPMU_Functions]]
stdClass Object
(
    [ID] => 5
    [post_author] => 3
    [post_date] => 2008-07-06 14:38:58
    [post_date_gmt] => 2008-07-06 21:38:58
    [post_content] => [raw input text of the post]
    [post_title] => [title]
    [post_category] => 0
    [post_excerpt] =>
    [post_status] => publish
    [comment_status] => open
    [ping_status] => open
    [post_password] =>
    [post_name] => 5
    [to_ping] =>
    [pinged] =>
    [post_modified] => 2008-07-06 14:39:20
    [post_modified_gmt] => 2008-07-06 21:39:20
    [post_content_filtered] =>
    [post_parent] => 0
    [guid] => <nowiki>http://mu.samplesite.net/exampleblog/?p=[ID]</nowiki>
    [menu_order] => 0
    [post_type] => post
    [post_mime_type] =>
    [comment_count] => 0
)
--[[WordPress:User:Unifex|Unifex]] 2008年7月6日,21:57 (UTC)
----
返回到 [[WordPress:WPMU_Functions| WPMU_Functions]]
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅Wordpress-mediawiki:版权的细节)。 未经许可,请勿提交受版权保护的作品!
取消 编辑帮助(在新窗口中打开)