0
的WordPress 3.5画廊图像我试图找出如何使用此代码referencing the answer to the question here:检索未连接
`global $post;
$post_subtitrare = get_post($post->ID);
$content = $post_subtitrare->post_content;
$pattern = get_shortcode_regex();
preg_match("/$pattern/s", $content, $match);
if(isset($match[2]) && ("gallery" == $match[2])) {
$atts = shortcode_parse_atts($match[3]);
$attachments = isset($atts['ids']) ? explode(',', $atts['ids']) : get_children('post_type=attachment&post_mime_type=image&post_parent=' . $post->ID .'&order=ASC&orderby=menu_order ID');
}`
检索相同的数据get_children()?目前,只有id被检索到,但我试过get_post()和get_posts()。
从get_children阵列串行化的数据:
{i:229;O:7:"WP_Post":24:{s:2:"ID";i:229;s:11:"post_author";s:1:"1";
s:9:"post_date";s:19:"2012-12-27 21:01:49";s:13:"post_date_gmt";
s:19:"2012-12-27 21:01:49";s:12:"post_content";s:0:""
;s:10:"post_title";s:8:"DSCN0703";s:12:"post_excerpt";
s:0:"";s:11:"post_status";s:7:"inherit";
s:14:"comment_status";s:6:"closed";
s:11:"ping_status";s:4:"open";s:13:"post_password";s:0:"";
s:9:"post_name";s:10:"dscn0703-6";s:7:"to_ping";s:0:"";s:6:"pinged";s:0:"";
s:13:"post_modified";s:19:"2012-12-27 21:01:49";s:17:"post_modified_gmt";
s:19:"2012-12-27 21:01:49";s:21:"post_content_filtered";s:0:"";
s:11:"post_parent";i:223;s:4:"guid";s:81:"http:/exampleurl.com/wp-content/uploads/2012/12/DSCN07031.jpg";s:10:"menu_order";i:1;s:9:"post_type";s:10:"attachment";s:14:"post_mime_type";s:10:"image/jpeg";s:13:"comment_count";s:1:"0";s:6:"filter";s:3:"raw";}
从代码序列化的数据: 一个:7:{I:0; S:3: “229”; I:1; S:3: “225”; I:2; S:3: “228”; I:3; S:3: “230”; I:4; S:3: “226”; I:5; S:3:“227 “; i:6; s:3:”232“;}
有人能指点我的wp钩子,它会给我和上面代码生成的id相同的数据get_children吗?