【发布时间】:2014-05-03 12:01:52
【问题描述】:
wordpress主题功能内的功能
function child_post_list($title){
$args = array('posts_per_page'=>1, 'post_type' => 'updatelist');
$update_list_post = get_posts( $args ); //UPDATE LIST post
if(isset($update_list_post[0])){
$args = array('meta_key'=>'_wpcf_belongs_updatelist_id', 'meta_value' => $update_list_post[0]->ID,'post_type' => "'indon-stat';'myanmar-stat'");
$child_posts = get_posts( $args ); //the child listing of UPDATE LIST post
foreach($child_posts as $post){
if(get_post_meta($post->ID, 'wpcf-biodata-code', true) == $title){ //if the post title is exist within the custom field of the child listing of UPDATE LIST post.
return 1;
}
}
}
}
如你所见,代码的最后部分
"'indon-stat';'myanmar-stat'");
这绝对是错误的语法,所以我想问一下什么是正确的?甚至可以为此插入多个帖子类型吗?
【问题讨论】:
-
这取决于您的应用程序。您可以使用数组、逗号或空格。但是,如果我们不了解足够的信息,我们将无能为力。
-
已编辑问题,认为我应该让它简单,我在 php 方面真的很糟糕
-
wordpress 是的,谢谢
-
@AD7six 这不是你说的那样,因为它更像是从多种帖子类型中检索
-
请编辑问题 - 不要写 cmets。