Wordpress按自定义文件自定义帖子

Wordpress按自定义文件自定义帖子,wordpress,custom-post-type,Wordpress,Custom Post Type,我有一个自定义帖子类型和一个自定义字段:expired\u date 我想显示帖子没有过期,所以基本上我想检查一下,如果过期的日期>当前的日期,帖子会显示出来 如何执行此WordPress循环查询 <?php $args = array( 'post_type' => 'job_listing' ); query_posts($args); ?> <?php while (have_posts()) :

我有一个自定义帖子类型和一个自定义字段:
expired\u date

我想显示帖子没有过期,所以基本上我想检查一下,如果
过期的日期>当前的日期
,帖子会显示出来

如何执行此WordPress循环查询

<?php
    $args = array(
        'post_type' => 'job_listing'

    );

    query_posts($args);
    ?>
        <?php while (have_posts()) : the_post(); ?>

你能帮我在自定义post查询中检查一下吗

$today = date('Ymd');
$args = array(
    'post_type' => 'job_listing',
    'meta_key' => 'the_date',
    'meta_query' => array(
        array(
            'key' => 'the_date',
            'value' => $today,
            'compare' => '>='
        )
    ),
    'orderby' => 'meta_value_num',
    'order' => 'ASC'
);

$your_custom_query = new WP_Query($args);
希望会有所帮助:)


希望会有帮助:)

你想要什么。你的意思是查询没有得到正确的帖子吗?我使用了上面的查询并打印了上次执行的查询,它打印了wp_Posteta中的SELECT post_id、meta_key、meta_值,其中post_id按meta_id ASC的(6461)顺序排列,这是错误的。问题是什么?你想要什么。你的意思是查询没有得到正确的帖子吗?我使用了上面的查询并打印了上次执行的查询,它打印了wp_Posteta中的SELECT post_id、meta_key、meta_值,其中post_id按meta_id ASC的(6461)顺序排列,这是错误的。问题是什么?更正Wordpress拼写!!更正Wordpress的拼写!!