2013-01-20 29 views
0

我試圖調整我的Wordpress主題上的日期格式,例如「1月20日」而不是完整的日期。調整日期格式,更改似乎隱藏代碼?

我已經根據Wordpress codex調整的代碼,例如:

<time datetime="<?php the_date('j, S, M'); ?>" pubdate><?php the_date(); ?> </time> 

根據食品法典委員會,這將給17日1月

奇怪的是,這並在顯示代碼,當我查看頁面源或檢查,但不顯示在任何地方的視圖。檢查代碼如下所示:

<time datetime="17, th, Jan" pubdate=""> </time> 

因此,它似乎是生成正確的代碼,但不輸出它。我做錯了什麼?

回答

1
<time datetime="<?php the_date('j, S, M'); ?>" pubdate><?php the_date(); ?> </time> 

應該是這樣的:

<time datetime="<?php the_date('j, S, M'); ?>" pubdate><?php the_date('j, S, M'); ?> </time> 

你是不是傳遞參數的第二個呼叫到the_date()這是一個將在視圖中顯示,對方是不作爲屬性輸出,不會顯示可見度。

+1

非常有意義格式的日期。道歉這是我第一次使用PHP。謝謝! – Francesca

0

隨着傳遞參數the_date的秒()調用,你問這將是

the_date('jS, M'); // output 20th, Jan 

<time datetime="<?php the_date('jS, M'); ?>" pubdate><?php the_date('jS, M'); ?> </time> 
+0

你能解釋這段代碼的第一部分在哪裏?我複製了這個,但它不起作用。 – Francesca

+0

對不起,這只是顯示該功能將出現。 –