2014-12-07 47 views
0

我需要在wordpress中檢索當前選定的月份,但我不知道要使用哪個函數。如何檢索wordpress中的selectd月份

的情況是:

  • 我點擊列表中的月份,(比如說八月)
  • 我重定向到包含刊登在

的所有帖子的頁面在此頁面中,我需要列印月份名稱:類似於「您正在瀏覽八月2014」中發佈的文章。

我該怎麼做?

乾杯

+0

這將是檔案標題(月/年)。你有什麼嘗試? – ggdx 2014-12-07 00:56:03

+0

archive.php應該讓你在那裏。 [看看Codex](http://codex.wordpress.org/Creating_an_Archive_Index) – jacobcc 2014-12-07 00:58:47

+0

yes archive是我到達的頁面。但是如果我想在頁面上打印月份的名稱怎麼辦? – nourdine 2014-12-07 01:00:51

回答

1

<?= single_month_title(); ?>

WP Codex使用,只是彈出它在哪裏需要就足夠了。

0

這裏是捆綁的主題20 14只archive.php如何實現這一點。這將顯示每年的日期,每月和每日檔案

<header class="page-header"> 

<h1 class="page-title"> 
    <?php 
     if (is_day()) : 
      printf(__('Daily Archives: %s', 'twentyfourteen'), get_the_date()); 

     elseif (is_month()) : 
      printf(__('Monthly Archives: %s', 'twentyfourteen'), get_the_date(_x('F Y', 'monthly archives date format', 'twentyfourteen'))); 

     elseif (is_year()) : 
      printf(__('Yearly Archives: %s', 'twentyfourteen'), get_the_date(_x('Y', 'yearly archives date format', 'twentyfourteen'))); 

     else : 
      _e('Archives', 'twentyfourteen'); 

     endif; 
    ?> 
</h1> 
</header><!-- .page-header --> 
相關問題