Wordpress에서 올바른 순서로 이벤트를 표시하는 데 문제가 있습니다. 나는 그것이 영국 날짜 형식이기 때문에 wordpress가 날짜를 문자열로 취급하고 하루로 주문하기 때문에 문제가 있다고 생각합니다.Wordpress 이벤트 목록 날짜 문제
목표는 최신 이벤트가있는 목록을 장부 상단에 표시하는 것입니다. 하지만 dd/mm/yyyy의 영국 날짜 형식을 사용해야합니다.
도면 보드로 돌아 가야합니까, 아니면 필요한 결과를 얻기 위해 날짜를 변환하는 방법이 있습니까? 사전에
감사합니다 :)
<ul>
<?php // Get today's date in the right format
$todaysDate = date('d/m/Y');?>
<?php query_posts('showposts=50&category_name=Training&meta_key=date&meta_compare=>=&meta_value=' . $todaysDate . '&orderby=meta_value&order=ASC'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<li>
<h3><a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a></h3>
<?php $getDate = get_post_meta($post->ID, 'date', TRUE);
$dateArray = explode('/', $getDate); ?>
<?php if($getDate != '') { ?>
<div class="coursedate rounded"><?php echo date('d F Y', mktime(0, 0, 0, $dateArray[1], $dateArray[0], $dateArray[2])); ?></div>
<?php } ?>
<p><?php get_clean_excerpt(140, get_the_content()); ?>...</p>
<p><strong><a class="link" href="<?php the_permalink(); ?>">For further details and booking click here</a></strong></p>
</li>
<?php endwhile; ?>
<?php else : ?>
<li>Sorry, no upcoming events!</li>
<?php endif; ?>
감사합니다. 일시적인 수정으로 동일한 효력을주는 포스트 expirator를 설치 했더라도. – Roger