【发布时间】:2015-03-03 15:02:35
【问题描述】:
我有自定义元 st_date 和 end_date
我想选择满足这两个条件的帖子:
1- end_date = "某个日期"
2- st_date = "某个日期"
3-我还需要按标题选择
4-然后在 WordPress 循环中使用结果。
if ( have_posts() ) : ?>
<?php get_template_part('loop'); ?> //etc..
这是我的草稿代码:
$st_date_s = 'something';
$end_date_s = 'something';
$pageposts = get_posts(
array(
'post_title' => 'something'
'post_type' => 'something',
'post_status' => 'publish',
'meta_query' => array(
array(
array( 'key' => 'st_date', 'value' => $st_date_s, 'compare' => '=' ),
array( 'key' => 'end_date', 'value' => $end_date_s, 'compare' => '=' )
)
),
)
);
?>
<?php global $site_url;
if ( have_posts() ) : ?>
<?php get_template_part('loop'); ?>
<?php else : ?>//etc..
还有为什么 'post_title'=> 不起作用?
【问题讨论】:
标签: wordpress