latest 글중에 가장최신만 고를수있나요??

k보드덕에 편리하게 게시판을 만드는 어느 나그네입니다.

예를들어 notice게시판에 최신글을중 5개를 main페이지에서 보여준다고할때 5개의 최신글중 가장 마지막에 작성된 글만 특정하는것이 가능한가요??

 

 

5번째 게시글 1월5일작성

4번째게시글 1월4일작성

3번째 게시글 1월3일작성

2번째 게시글 1월2일작성

1번째 게시글 1월1일작성

 

이라고 할때 가장 마지막에 작성된, 1월5일에 작성한 5번째 게시글에는 last 라는 클래스명을 붙이고 싶습니다.

 

이런것도 가능할지 궁금합니다.

좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기
좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기
  • 안녕하세요~^^

    어떤 스킨을 사용 중이신지요?

    스킨마다 코드가 다를 수도 있기 때문에

    default 스킨을 기준으로 안내해드리겠습니다.

    FTP로 접속해서 /wp-content/plugins/kboard/skin/사용중인스킨/latest.php 파일에

    아래의 코드를 찾아서

    <?php while($content = $list->hasNext()):?>
    <tr>
    	<td class="kboard-latest-title">
    		<a href="<?php echo $url->set('uid', $content->uid)->set('mod', 'document')->toStringWithPath($board_url)?>">
    			<div class="kboard-default-cut-strings">
    				<?php if($content->isNew()):?><span class="kboard-default-new-notify">N</span><?php endif?>
    				<?php if($content->secret):?><img src="<?php echo $skin_path?>/images/icon-lock.png" alt="<?php echo __('Secret', 'kboard')?>"><?php endif?>
    				<?php echo $content->title?>
    				<span class="kboard-comments-count"><?php echo $content->getCommentsCount()?></span>
    			</div>
    		</a>
    	</td>
    	<td class="kboard-latest-date"><?php echo $content->getDate()?></td>
    </tr>
    <?php endwhile?>

    아래의 코드로 교체해보시겠어요?

    <?php while($content = $list->hasNext()):?>
    <tr<?php if($list->index() == '1'):?> class="last"<?php endif?>>
    	<td class="kboard-latest-title">
    		<a href="<?php echo $url->set('uid', $content->uid)->set('mod', 'document')->toStringWithPath($board_url)?>">
    			<div class="kboard-default-cut-strings">
    				<?php if($content->isNew()):?><span class="kboard-default-new-notify">N</span><?php endif?>
    				<?php if($content->secret):?><img src="<?php echo $skin_path?>/images/icon-lock.png" alt="<?php echo __('Secret', 'kboard')?>"><?php endif?>
    				<?php echo $content->title?>
    				<span class="kboard-comments-count"><?php echo $content->getCommentsCount()?></span>
    			</div>
    		</a>
    	</td>
    	<td class="kboard-latest-date"><?php echo $content->getDate()?></td>
    </tr>
    <?php endwhile?>

    위 코드는 리스트 게시글 번호 표시 설정이 오름차순으로 되어 있을 경우

    가장 최신글의 <tr> 태그에 last 클래스를 추가하는 코드입니다.

     

    만약 최신글 숏코드의 rpp가 5로 되어 있고 리스트 게시글 번호 표시 설정이 내림차순이라면

    아래의 코드를

    <?php if($list->index() == '1'):?>

    아래의 코드로 적용해주시면 됩니다.

    <?php if($list->index() == '5'):?>

    리스트 게시글 번호 표시 설정은

    워드프레스 관리자 -> KBoard -> 게시판 목록 -> 게시판 선택 -> 기본설정 페이지에서

    확인하실 수 있습니다.

    고맙습니다.

워드프레스 에러 기술지원 서비스 전문가에게 맡기세요