게시판 목록에 썸네일 보이기

안녕하세요,

default 게시판을 사용중인데요,

썸네일 따로 등록 없이 게시글에 이미지를 첨부할시에

아래와 이미지와 같이 게시글 목록에 작게 이미지 썸네일이 표시될 수 있을까요?

PC,모바일 두곳에서 전부다요.

감사합니다.

워드프레스 에러 기술지원 서비스 전문가에게 맡기세요
좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기
  • 안녕하세요~^^

    KBoard 기본 스킨 중 Thumbnail 스킨을 활용하시면

    보다 편리하게 썸네일을 출력하실 수 있습니다.

     

    default 게시판에서 썸네일을 출력하시려면 아래 코드를 원하시는 위치에

    삽입해보시겠어요?

    <?php if($content->getThumbnail(90, 90)):?><img src="<?php echo $content->getThumbnail(90, 90)?>" alt="<?php echo esc_attr($content->title)?>"><?php endif?>

    이미지 자체의 크기는 90, 90 위치에

    가로, 세로 크기를 적절히 조정하여 입력해주세요

    고맙습니다.

  • 답변 감사합니다. 말씀하신 코드는 skin > default > list.php 에 삽입하면 되는 것인지요?

    아래 코드 밑에 넣었는데 썸네일이 안보여서요

     

    <!-- 리스트 시작 -->
    	<div class="kboard-list">
    		<table>
    			<thead>
    				<tr>
    					<td class="kboard-list-uid"><?php echo __('Number', 'kboard')?></td>
    					<td class="kboard-list-title"><?php echo __('Title', 'kboard')?></td>
    					<td class="kboard-list-user"><?php echo __('Author', 'kboard')?></td>
    					<td class="kboard-list-date"><?php echo __('Date', 'kboard')?></td>
    					<td class="kboard-list-vote"><?php echo __('Votes', 'kboard')?></td>
    					<td class="kboard-list-view"><?php echo __('Views', 'kboard')?></td>
    				</tr>
    			</thead>
    			<tbody>
    				<?php while($content = $list->hasNextNotice()):?>
    				<tr class="kboard-list-notice<?php if($content->uid == kboard_uid()):?> kboard-list-selected<?php endif?>">
    					<td class="kboard-list-uid">공지</td>
    					<td class="kboard-list-title">
    						<a href="<?php echo esc_url($url->getDocumentURLWithUID($content->uid))?>">
    							<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 if($content->category1):?>[<?php echo $content->category1?>]<?php endif?>
    								<?php if($content->category2):?>[<?php echo $content->category2?>]<?php endif?>
    								<?php echo $content->title?>
    								<span class="kboard-comments-count"><?php echo $content->getCommentsCount()?></span>
    							</div>
    						</a>
    						<div class="kboard-mobile-contents">
    							<span class="contents-item kboard-user"><?php echo $content->getUserDisplay()?></span>
    							<span class="contents-separator kboard-date">|</span>
    							<span class="contents-item kboard-date"><?php echo $content->getDate()?></span>
    							<span class="contents-separator kboard-vote">|</span>
    							<span class="contents-item kboard-vote"><?php echo __('Votes', 'kboard')?> <?php echo $content->vote?></span>
    							<span class="contents-separator kboard-view">|</span>
    							<span class="contents-item kboard-view"><?php echo __('Views', 'kboard')?> <?php echo $content->view?></span>
    						</div>
    					</td>
    					<td class="kboard-list-user"><?php echo $content->getUserDisplay()?></td>
    					<td class="kboard-list-date"><?php echo $content->getDate()?></td>
    					<td class="kboard-list-vote"><?php echo $content->vote?></td>
    					<td class="kboard-list-view"><?php echo $content->view?></td>
    				</tr>
    				<?php endwhile?>
    				<?php while($content = $list->hasNext()):?>
    				<tr class="<?php if($content->uid == kboard_uid()):?>kboard-list-selected<?php endif?>">
    					<td class="kboard-list-uid"><?php echo $list->index()?></td>
    					<td class="kboard-list-title">
    						<a href="<?php echo esc_url($url->getDocumentURLWithUID($content->uid))?>">
    							<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 if($content->category1):?>[<?php echo $content->category1?>]<?php endif?>
    								<?php if($content->category2):?>[<?php echo $content->category2?>]<?php endif?>
    								<?php echo $content->title?>
    								<span class="kboard-comments-count"><?php echo $content->getCommentsCount()?></span>
    							</div>
    						</a>
    						<div class="kboard-mobile-contents">
    							<span class="contents-item kboard-user"><?php echo $content->getUserDisplay()?></span>
    							<span class="contents-separator kboard-date">|</span>
    							<span class="contents-item kboard-date"><?php echo $content->getDate()?></span>
    							<span class="contents-separator kboard-vote">|</span>
    							<span class="contents-item kboard-vote"><?php echo __('Votes', 'kboard')?> <?php echo $content->vote?></span>
    							<span class="contents-separator kboard-view">|</span>
    							<span class="contents-item kboard-view"><?php echo __('Views', 'kboard')?> <?php echo $content->view?></span>
    						</div>
    					</td>
    					<td class="kboard-list-user"><?php echo $content->getUserDisplay()?></td>
    					<td class="kboard-list-date"><?php echo $content->getDate()?></td>
    					<td class="kboard-list-vote"><?php echo $content->vote?></td>
    					<td class="kboard-list-view"><?php echo $content->view?></td>
    				</tr>
    				<?php $boardBuilder->builderReply($content->uid)?>
    				<?php endwhile?>

     

  • list.php 파일에서 아래의 코드가 공지사항을 출력하는 부분입니다.

    <?php while($content = $list->hasNextNotice()):?>
    ...
    <?php endwhile?>

    아래의 코드가 공지사항이 아닌 일반 게시글을 표시하는 코드입니다.

    <?php while($content = $list->hasNext()):?>
    ...
    <?php endwhile?>

    해당 코드 사이에 썸네일 관련 코드를 삽입해주셔야 합니다.

    고맙습니다.

  • 해당 위치에 아래와 같이 코드를 입력하였더니 공지사항 하단 리스트가 전부 보이지 않습니다.

    어떠한 에러일까요?

     

    <?php while($content = $list->hasNextNotice()):?>
    				<tr class="kboard-list-notice<?php if($content->uid == kboard_uid()):?> kboard-list-selected<?php endif?>">
    					<td class="kboard-list-uid">공지</td>
    					<td class="kboard-list-title">
    						<a href="<?php echo esc_url($url->getDocumentURLWithUID($content->uid))?>">
    							<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 if($content->category1):?>[<?php echo $content->category1?>]<?php endif?>
    								<?php if($content->category2):?>[<?php echo $content->category2?>]<?php endif?>
    								<?php echo $content->title?>
    								<span class="kboard-comments-count"><?php echo $content->getCommentsCount()?></span>
    							</div>
    						</a>
    						<div class="kboard-mobile-contents">
    							<span class="contents-item kboard-user"><?php echo $content->getUserDisplay()?></span>
    							<span class="contents-separator kboard-date">|</span>
    							<span class="contents-item kboard-date"><?php echo $content->getDate()?></span>
    							<span class="contents-separator kboard-vote">|</span>
    							<span class="contents-item kboard-vote"><?php echo __('Votes', 'kboard')?> <?php echo $content->vote?></span>
    							<span class="contents-separator kboard-view">|</span>
    							<span class="contents-item kboard-view"><?php echo __('Views', 'kboard')?> <?php echo $content->view?></span>
    						</div>
    					</td>
    					<td class="kboard-list-user"><?php echo $content->getUserDisplay()?></td>
    					<td class="kboard-list-date"><?php echo $content->getDate()?></td>
    					<td class="kboard-list-vote"><?php echo $content->vote?></td>
    					<td class="kboard-list-view"><?php echo $content->view?></td>
    				</tr>
    				<?php endwhile?>
    				
    				<?php if($content->getThumbnail(90, 90)):?><img src="<?php echo $content->getThumbnail(90, 90)?>" alt="<?php echo esc_attr($content->title)?>"><?php endif?>
    				
    				<?php while($content = $list->hasNext()):?>
    				<tr class="<?php if($content->uid == kboard_uid()):?>kboard-list-selected<?php endif?>">
    					<td class="kboard-list-uid"><?php echo $list->index()?></td>
    					<td class="kboard-list-title">
    						<a href="<?php echo esc_url($url->getDocumentURLWithUID($content->uid))?>">
    							<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 if($content->category1):?>[<?php echo $content->category1?>]<?php endif?>
    								<?php if($content->category2):?>[<?php echo $content->category2?>]<?php endif?>
    								<?php echo $content->title?>
    								<span class="kboard-comments-count"><?php echo $content->getCommentsCount()?></span>
    							</div>
    						</a>
    						<div class="kboard-mobile-contents">
    							<span class="contents-item kboard-user"><?php echo $content->getUserDisplay()?></span>
    							<span class="contents-separator kboard-date">|</span>
    							<span class="contents-item kboard-date"><?php echo $content->getDate()?></span>
    							<span class="contents-separator kboard-vote">|</span>
    							<span class="contents-item kboard-vote"><?php echo __('Votes', 'kboard')?> <?php echo $content->vote?></span>
    							<span class="contents-separator kboard-view">|</span>
    							<span class="contents-item kboard-view"><?php echo __('Views', 'kboard')?> <?php echo $content->view?></span>
    						</div>
    					</td>
    					<td class="kboard-list-user"><?php echo $content->getUserDisplay()?></td>
    					<td class="kboard-list-date"><?php echo $content->getDate()?></td>
    					<td class="kboard-list-vote"><?php echo $content->vote?></td>
    					<td class="kboard-list-view"><?php echo $content->view?></td>
    				</tr>
    				<?php $boardBuilder->builderReply($content->uid)?>
    				<?php endwhile?>

     

  • 썸네일 관련 코드를

    공지사항과 일반 게시글을 표시하는 코드 사이가 아닌

    공지사항을 표시하는 코드 while문 사이와

    일반 게시글을 표시하는 코드 while문 사이에 추가해보시겠어요?

    고맙습니다.

  • <?php while($content = $list->hasNext()):?>
    				<tr class="<?php if($content->uid == kboard_uid()):?>kboard-list-selected<?php endif?>">
    					<td class="kboard-list-uid"><?php echo $list->index()?></td>
    					<td class="kboard-list-title">
    						<a href="<?php echo esc_url($url->getDocumentURLWithUID($content->uid))?>">
    							<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 if($content->category1):?>[<?php echo $content->category1?>]<?php endif?>
    								<?php if($content->category2):?>[<?php echo $content->category2?>]<?php endif?>
    								<?php echo $content->title?>
    								<span class="kboard-comments-count"><?php echo $content->getCommentsCount()?></span>
    							</div>
    						</a>
    						<div class="kboard-mobile-contents">
    							<span class="contents-item kboard-user"><?php echo $content->getUserDisplay()?></span>
    							<span class="contents-separator kboard-date">|</span>
    							<span class="contents-item kboard-date"><?php echo $content->getDate()?></span>
    							<span class="contents-separator kboard-vote">|</span>
    							<span class="contents-item kboard-vote"><?php echo __('Votes', 'kboard')?> <?php echo $content->vote?></span>
    							<span class="contents-separator kboard-view">|</span>
    							<span class="contents-item kboard-view"><?php echo __('Views', 'kboard')?> <?php echo $content->view?></span>
    						</div>
    					</td>
    					<td class="kboard-list-user"><?php echo $content->getUserDisplay()?></td>
    					<td class="kboard-list-date"><?php echo $content->getDate()?></td>
    					<td class="kboard-list-vote"><?php echo $content->vote?></td>
    					<td class="kboard-list-view"><?php echo $content->view?></td>
    				</tr>
    				<?php $boardBuilder->builderReply($content->uid)?>
    				<?php endwhile?>
    				

    말씀하신대로 while문 사이에 넣었더니 게시글 목록 제목 옆이 아닌 엉뚱한곳에 표시가 됩니다.

    while과 endwhile 사이 어떤 공간에 넣어도 마찬가지입니다.

  • 현재 올려주신 코드에는 썸네일 관련 코드가 없습니다.

    <tr> 태그 사이에 코드를 추가하셨다면

    <td> 태그 내부에 썸네일 코드를 삽입해주셔야 합니다.

     

    스킨 파일을 수정하시기 전

    HTML과 CSS,  상황에 따라서는 Javascript에 대한 이해가 어느 정도 있으셔야 합니다.

    고맙습니다.

  • 말씀해주신대로 하여 해결하였습니다 :)

    알려주신 아래의 코드로 하니 현재는 모든 게시판 목록에 썸네일이 보이는데요,

    <?php if($content->getThumbnail(90, 90)):?><img src="<?php echo $content->getThumbnail(90, 90)?>" alt="<?php echo esc_attr($content->title)?>"><?php endif?>

    이 썸네일이 특정게시판들에서만 보이게 하거나, 특정게시판들에서만 보이지 '않게'하려면 어떻게 할까요?

    아마

    if($board->id == '14'){ // 실제 게시판 id로 적용해주세요.

    요 구문이 들어가지 않을까하는데 문의드리겠습니다.

    감사합니다 :)

  • 특정 게시판에만 해당 코드를 적용하시려면

    $content->getThumbnail(90, 90) 부분을 $content->getThumbnail(90, 90) && $board->id == '14' 이런 식으로 교체해보세요.

    고맙습니다.

좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기