그래서 "이벤트"라는 사용자 정의 게시 유형이 있습니다. 각 이벤트에는 "08/01/12"와 같은 날짜를 반환하는 "start_time_date"라는 사용자 정의 필드가 있습니다. 게시물이 start_time_date에 따라 오름차순으로 정렬되도록 게시물을 정렬하려면 어떻게해야합니까 (현재 날짜에 가까운 start_time_dates가 먼저 표시됨). 내가 date
데이터베이스 컬럼에 있지만이 같은 뭔가 정확히 모르겠습니다사용자 지정 날짜로 WordPress 쿼리를 정렬하는 방법?
<? query_posts("cat=$currentID&showposts=100&orderby=date&order=asc"); ?>
:
<? query_posts("cat=$currentID&showposts=100"); ?>
<? if (have_posts()) : ?>
<? while (have_posts()) : the_post(); if (time() < strtotime(get('end_time_date'))) :?>
<? $originalDate = get('start_time_date'); $newDate = date("M j, Y", strtotime($originalDate)); ?>
<div class="post">Some Post Data</div>
<? endif; endwhile; ?>
<? endif; ?>
예. 그것은 기본 WordPress 게시일 기준으로 만 정렬됩니다. 사용자 정의 날짜 필드로 정렬하려고합니다. – raeq
기사에 대한 링크를 포함하도록 내 대답을 업데이트했습니다. – Biotox
감사합니다. 그게 효과가있어. – raeq