2016-08-13 9 views
0

私の計画は、日付検索フォームを作ることですが、私は8月13日検索した場合、たとえば、それは何も表示されませんので、私は検索中にポスト日付を照会する必要があり、はワードプレスに日付別の投稿を検索

投稿の投稿日を検索する

私はこのコードを使用していますが、何も起こりません。私はこの記事を読んでみましたhttps://developer.wordpress.org/reference/functions/query_posts/、私は非常に申し訳ありません。私はwordpressとphpで新しく、ありがとうございました。私は、これは間違った

 <?php 
     global $wp_query; 
     $args = array_merge($wp_query->query, array('posts_per_page' => 12, 
     'year' => $current_year, 
     'monthnum' => $current_month, 
     'order' => 'ASC')); 
     query_posts($args);   
     $x = 0; 
     while (have_posts()) : the_post(); ?>  

だと思うと、これはあなたのような何か試してみてください、私の通常の検索

  <?php 
     global $wp_query; 
     $args = array_merge($wp_query->query, array('posts_per_page' => 12)); 
     query_posts($args);   
     $x = 0; 
     while (have_posts()) : the_post(); ?>  

答えて

1

です:これは、のリンクを持つタイトルの単純なリストが表示されます

<?php 
$year = '1365'; 
$month = '03'; 
$day = '30'; 
$search_date = new WP_Query('year=' . $year . '&monthnum=' . $month . '&day=' . $day); 
if($search_date->have_posts()) : while ($search_date->have_posts()) : $search_date->the_post();?> 
    <a href="<?php the_permalink(); ?>"> 
     <?php the_title(); ?> 
    </a> 
    <br/> 
<?php endwhile; endif; ?> 

を投稿数:1365.03.30

関連する問題