2013-02-01 4 views
0

카테고리에 따라 날짜의 색상을 강조하기 위해 표준 WordPress 캘린더를 편집 했으므로 캘린더 기능은 해당 날짜에 모든 게시물을로드하는 get_day_link()을 사용하지만 특정 카테고리로만 제한하려고합니다 . 여기에 일 클릭 가능한 링크를 만드는 코드는 내가 URL에 추가 할 수 아무것도 기능이 get_calendar()wordpress, 아카이브 페이지 카테고리 지정하기

if (in_array($day, $daywithevent) && in_array($day, $daywithtraining)) // are there both events AND training happening today? 
      $calendar_output .= '<td class="training-events-calendar"><a href="' . get_day_link($thisyear, $thismonth, $day) . '" title="' . esc_attr($ak_titles_for_day[ $day ]) . "\">$day</a>"; 
    elseif (in_array($day, $daywithtraining)) // how about just training? 
      $calendar_output .= '<td class="training-calendar"><a href="' . get_day_link($thisyear, $thismonth, $day) . "\">$day</a>"; 
    elseif (in_array($day, $daywithevent) ) //how about just events? 
      $calendar_output .= '<td class="event-calendar"><a href="' . get_day_link($thisyear, $thismonth, $day) . "\">$day</a>"; 
    else 
     $calendar_output .= '<td>'.$day; 
    $calendar_output .= '</td>'; 

이다, 이것은 일반 template.php 파일의 편집입니다 있나요입니까? 이러한 3 개의 링크 카테고리를 구체적으로 만드는 쿼리를 좋아합니까? get_day_link 감사

답변

3
난 당신이 무엇을하고 있는지 확인를 havent

하지만 당신이 할 수있는 1 일이

<?php 
$query = new WP_Query(array('post_type' => 'post','category__in' => array(2, 6), 'year'=>get_the_date('Y'),'monthnum'=>get_the_date('m'),'day'=> get_the_date('d'))); 

if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); 
?> 
post details goes here 

<?php endwhile; endif; wp_reset_query();?> 
같은 루프를 당신의 카테고리와 동일한 date.php 파일을 만들고 실행되는 추가 아무것도 것 같다 나던
+0

감사하지만 문제는 위의 코드에서 변수를 기반으로 한 날짜에 대한 쿼리가 필요하지만 어딘가에서 내 루프 내에서 해당 루프를 구현하려고 시도 할 수 있습니다. – Adrian

+1

oo 나중에 나는 dat를 남겼다. 나는 나의 대답을 편집했다. 그게 도움이 될거야 :) – anstrangel0ver

+0

고마워,하지만 문제는 내 코드가 아카이브 URL을 생성하기 위해'get_day_link'를 사용하기 때문에이 루프를 클릭 가능한 URL로 만드는 방법이다. – Adrian

관련 문제