번역 나는 내 워드 프레스 포스트를 통해 루프 PHP의 다음과 같은 부분이 있습니다날짜 형식
<?php
$items = 0;
$thiscat = get_category(2);
$cat_slug = $thiscat->slug;
$args = array(
'post_type' => 'Course',
'category_name' => $cat_slug,
'order' => 'ASC',
);
$loop = new WP_Query($args);
while ($loop->have_posts() AND $items < 3) {
$loop->the_post();
$category_course = get_the_category(2);
$cat_slug_course = $category_course[0]->slug;
$date_start = get_post_meta(get_the_ID(), 'date_start', true);
$place = get_post_meta(get_the_ID(), "place", true);
$date_start = date("D, M d, Y", $date_start);
if(strtotime($date_start) >= strtotime('today')) { ?>
<li>
<a href="<?php the_permalink(); ?>" class="date_fp"><?php echo $date_start; ?> - <?php echo $place; ?></a>
</li>
<?php $items++; }
}
if($items==0) { ?>
<li>
Ingen kommende kurser
</li>
<?php } ?>
그것은 루프 및 디스플레이 과정에 대한 세 가지 시작 날짜까지입니다. 그러나 $date_start
을 영어 대신 덴마크어로 출력하고 싶습니다.
I 내 루프는 아니오 (Ingen kommende kurser
출력 (% A, % d 개의 %의 B, %의 Y)를 strftime로 일을 1,8- 덴마크어 locale을 설정했지만, 어떠한 방법으로, 날짜 형식을 변경할 때하면 STRFTIME하려고 미래 과정). 이것은 이상한 일입니다. 왜냐하면 날짜로 작업 할 때 (그리고 영어 출력을 얻을 때), 코스 날짜가 표시되기 때문입니다.
$의 DATE_START는
내가 시도 해결책 시간 (밀리 초) (예를 들어, 1371081600137535
)를 출력하지만, 작동하지 않았다 :
...
$place = get_post_meta(get_the_ID(), "place", true);
setlocale(LC_ALL, 'nl_NL');
$date_start = strftime("%a, %d %b, %Y", mktime($date_start));
if(strtotime($date_start) >= strtotime('today')) { ?>
...
시스템에 원하는 로케일이 설치되어 있습니까? – nils