上下文:如何向数组添加多个值?
我有以下代码,我正在尝试修复。此代码会过滤我网站上的相册(自定义wordpress文章称为“freealbums”)。
的代码过滤通过艺术家的freealbums(自定义后类型,称为“艺术家”)和代码工作不错,但我试图做一个过滤器,让人们进行排序freealbums邮寄类型:
artist, upcomingartist and producer
而不仅仅是艺术家的帖子类型,但我似乎不能添加多个帖子类型,以此代码并使其工作。
if(isset($_GET['a']) && intval($_GET['a']) != 0) {
$atts = themex_get_query(themex_get_posts('freealbum',array('ID'),-1, array('artists','upcomingartist'=>$_GET['a'])), $limit, $paged);
} else {
$atts = array(
'post_type' =>'freealbum',
'posts_per_page' => $limit,
'paged' => $paged,
'meta_key' => '_thumbnail_id',
);
}
query_posts($atts);
这里是我做了尝试,并添加另一篇文章类型:
if(isset($_GET['a']) && intval($_GET['a']) !=0) {
$atts=themex_get_query(themex_get_posts('freealbum',array('ID'),-1, array('artists','upcomingartist'=>$_GET['a'])), $limit, $paged);
} else {
$atts=array(
'post_type' =>'freealbum',
'posts_per_page' => $limit,
'paged' => $paged,
'meta_key' => '_thumbnail_id',
);
}
query_posts($atts);
正如你所看到的一切,我改变了下面的一段代码
array('artists'=>$_GET['a'])),
为了这
array('artists','upcomingartist'=>$_GET['a'])),
我以为这可以工作,但对于某些WEIRD原因,过滤器现在可以使用upcomingartist
发布类型,但它停止使用艺术家发布类型。
不知道我在做什么错..请帮助!
,你能否告诉这个函数的内容:' themex_get_posts()'? – Darren