내가쓴글 페이지 만들기 질문입니다.

1. 정확한 제품 또는 플러그인 이름

KBoard

 

2. 상세 내용

html 기반의 테마라서 그런지 위젯 플러그인을 쇼트코드로 변환하는 방법은 안되더라고요. 그래서 그냥 db에서 데이터를 가져와서 게시판 리스트 형식 그대로 출력하고 하는데요

 

<?php

function get_myPosts_list() {

global $wpdb;

if(is_user_logged_in()){

$where = array();

$user_id = get_current_user_id();

$where[] = "`member_uid`='{$user_id}'";

$exclude = esc_sql("7");

$where[] = "`board_id` NOT IN ({$exclude})";

$where[] = "(`status`='' OR `status` IS NULL OR `status`='pending_approval')";

$where = implode(' AND ', $where);

$results = $wpdb->get_results("SELECT `uid` FROM `{$wpdb->prefix}kboard_board_content` WHERE {$where} ORDER BY `date` DESC");

$count = count($results);

$page_total = ceil($count / 20);

$url = "/my-post";

$skin_path = "/wp-content/plugins/kboard/skin/avatar-cryptonia-custom";

ob_start(); // 출력 버퍼링 시작

?>

<div id="kboard-avatar-list">

<div class="kboard-list-header">

<div class="kboard-total-count"><?php echo __('Total', 'kboard')?> <?php echo $count?></div>

<div class="kboard-sort">

<?php echo $url->set('pageid', '')->set('category1', '')->set('category2', '')->set('target', '')->set('keyword', '')->set('mod', 'list')->set('kboard_list_sort_remember', '')->toInput()?>

<form id="kboard-sort-form-user-id-<?php echo $user_id?>" method="get" action="<?php echo esc_url($url->toString())?>">

<select name="kboard_list_sort" onchange="jQuery('#kboard-sort-form-user-id-<?php echo $user_id?>').submit();">

<option value="newest"<?php if($results->getSorting() == 'newest'):?> selected<?php endif?>><?php echo __('Newest', 'kboard')?></option>

<option value="best"<?php if($results->getSorting() == 'best'):?> selected<?php endif?>><?php echo __('Best', 'kboard')?></option>

<option value="viewed"<?php if($results->getSorting() == 'viewed'):?> selected<?php endif?>><?php echo __('Viewed', 'kboard')?></option>

<option value="updated"<?php if($results->getSorting() == 'updated'):?> selected<?php endif?>><?php echo __('Updated', 'kboard')?></option>

</select>

</form>

</div>

</div>

<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 = $results->hasNext()):?>

<tr class="<?php echo esc_attr($content->getClass())?>">

<td class="kboard-list-uid"><?php echo $results->index()?></td>

<td class="kboard-list-title">

<a href="<?php echo esc_url($url->getDocumentURLWithUID($content->uid))?>">

<div class="kboard-avatar-cut-strings">

<?php if($content->isNew()):?><span class="kboard-avatar-new-notify">New</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>

<div class="kboard-mobile-contents">

<span class="contents-item kboard-user">

<?php echo $content->getUserDisplay(sprintf('%s %s', get_avatar($content->getUserID(), 24, '', $content->getUserName()), add_rank_img_content($content, 12).$content->getUserName()))?>

</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(sprintf('%s<br>%s', get_avatar($content->getUserID(), 24, '', $content->getUserName()), add_rank_img_content($content, 12).$content->getUserName()))?>

</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?>

</tbody>

</table>

</div>

<div class="kboard-pagination">

<ul class="kboard-pagination-pages">

<?php echo kboard_pagination($list->page, $page_total, $list->rpp)?>

</ul>

</div>

</div>

<?php

return ob_get_clean();

}

}

get_myPosts_list();


조금만 더 만지면 작동할거 같은데 여기서 뭘 어떻게 더 수정해야 sort 기능이랑 페이지네이션 기능까지 해서 살릴 수 있을까요?

 

3. 확인 가능한 상세 페이지 주소

 

 

4. 수정한 코드 내역 (있다면)

 

 

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