我有這個功能function show_contents(){$post_id = 3135;$post_content = get_post($post_id);$content = $post_content->post_content;$content_final = '<p style="line-height:1; color:white; font-family:Georgia, serif;">';apply_filters('the_content',$content);$content_final .= '</p>';return $content_final;}我想在星期一打印結果。對于打印我有這個代碼 date_default_timezone_set('Europe/Copenhagen'); $day = date("l"); if( $day == "Monday"){ show_contents();}但我在帖子中沒有看到我放置 XYZ Php 代碼插件的簡碼的內容。
1 回答

阿晨1998
TA貢獻2037條經驗 獲得超6個贊
嘗試這個:
$day = date("l");
switch(date("N"))
{
case 1: //Monday
{
show_contents(); break;
}
case 2: //Tuesday
{
// other function
break;
}
// Add the other week days here if you nees (3,4,5 and 6)
case 7: //Sunday
{
// other function
break;
}
}
- 1 回答
- 0 關注
- 148 瀏覽
添加回答
舉報
0/150
提交
取消