관리자 계정일 때만 게시글이 오래된 순으로 나와요

비회원이나 그냥 일반 회원으로 보면 게시글이 최신순으로 나오는데

 

관리자 계정으로 접속만 하면 오래된 순으로 나와서 게시글 수정하기가 어렵네요 ㅜㅜ

 

어떻게 해야 할까요?

 

<?php
/**
 * Extra files & functions are hooked here.
 *
 * Displays all of the head element and everything up until the "site-content" div.
 *
 * @package Avada
 * @subpackage Core
 * @since 1.0
 */

// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
	exit( 'Direct script access denied.' );
}

if ( ! defined( 'AVADA_VERSION' ) ) {
	define( 'AVADA_VERSION', '6.0' );
}

if ( ! defined( 'AVADA_MIN_PHP_VER_REQUIRED' ) ) {
	define( 'AVADA_MIN_PHP_VER_REQUIRED', '5.6' );
}

if ( ! defined( 'AVADA_MIN_WP_VER_REQUIRED' ) ) {
	define( 'AVADA_MIN_WP_VER_REQUIRED', '4.7' );
}

// Developer mode.
if ( ! defined( 'AVADA_DEV_MODE' ) ) {
	define( 'AVADA_DEV_MODE', false );
}

/**
 * Compatibility check.
 *
 * Check that the site meets the minimum requirements for the theme before proceeding.
 *
 * @since 6.0
 */
if ( version_compare( $GLOBALS['wp_version'], AVADA_MIN_WP_VER_REQUIRED, '<' ) || version_compare( PHP_VERSION, AVADA_MIN_PHP_VER_REQUIRED, '<' ) ) {
	require_once get_template_directory() . '/includes/bootstrap-compat.php';
	return;
}

/**
 * Bootstrap the theme.
 *
 * @since 6.0
 */
require_once get_template_directory() . '/includes/bootstrap.php';

/* Omit closing PHP tag to avoid "Headers already sent" issues. */


add_filter('kboard_list_where', 'my_kboard_list_where', 10, 3);
function my_kboard_list_where($where, $board_id, $content_list){
	if($board_id == '7'){ 
		$where = "`vote`>='{$vote}' AND `board_id` IN ('4') AND `parent_uid`='0' AND `notice`='' AND (`status`='' OR `status` IS NULL OR `status`='pending_approval')";
	    $content_list->setSorting('newest');
	}
	if($board_id == '8'){
    $view = '10';
    $where = "`view`>='{$view}' AND `board_id` IN ('1') AND `parent_uid`='0' AND `notice`='' AND (`status`='' OR `status` IS NULL OR `status`='pending_approval')";
    $content_list->setSorting('newest');
	}
	
    if($board_id == '1'){
		$content_list->setSorting('newest');
		}
	if($board_id == '2'){
		$content_list->setSorting('newest');
		}
	if($board_id == '3'){
		$content_list->setSorting('newest');
		}
	if($board_id == '4'){
		$content_list->setSorting('newest');
		}
	if($board_id == '6'){
		$where = "`notice`!='' AND (`status`='' OR `status` IS NULL OR `status`='pending_approval')";
		$content_list->setSorting('newest');
		}	
	if($board_id == '11'){
		$where = "`notice`='' AND (`status`='' OR `status` IS NULL OR `status`='pending_approval')";
		$content_list->setSorting('newest');
	}
	return $where;
}

add_filter('kboard_allowed_board_id', 'my_kboard_allowed_board_id', 10, 2);
function my_kboard_allowed_board_id($allowed_board_id, $board_id){
	if($allowed_board_id == '7'){
		$allowed_board_id = array('7', '4');
	}
	else if($allowed_board_id == '8'){
		$allowed_board_id = array('8', '10');
	}
	else if($allowed_board_id == '6'){
		$allowed_board_id = array('6', '1', '2', '3', '4', '6', '7');
	}
	else if($allowed_board_id == '11'){
		$allowed_board_id = array('11', '1', '2', '3', '4', '6', '7', '8', '9', '10');
	}
	return $allowed_board_id;
}

add_filter('kboard_get_template_field_data', 'my_kboard_get_template_field_data', 10, 3);
function my_kboard_get_template_field_data($field, $content, $board){
	$field_type = isset($field['field_type'])&&$field['field_type'] ? $field['field_type'] : '';
	if($board->isAdmin() && $field_type == 'category1' && $board->id == '1'){ 
		$field['required'] = '';
	}
	if($board->isAdmin() && $field_type == 'category1' && $board->id == '2'){ 
		$field['required'] = '';
	}
	if($board->isAdmin() && $field_type == 'category1' && $board->id == '3'){ 
		$field['required'] = '';
	}
	if($board->isAdmin() && $field_type == 'category1' && $board->id == '4'){ 
		$field['required'] = '';
	}
	if($board->isAdmin() && $field_type == 'category1' && $board->id == '6'){ 
		$field['required'] = '';
	}
	return $field;
}

function my_init(){
	$kboard_comments_sort = isset($_GET['kboard_comments_sort'])?$_GET['kboard_comments_sort']:'oldest';
	
	if(!in_array($kboard_comments_sort, array('best', 'oldest', 'newest'))){
		$kboard_comments_sort = 'best';
	}
	
	$_COOKIE['kboard_comments_sort'] = $kboard_comments_sort;
	
}

function my_kboard_list_where_best($where, $board_id, $content_list){
	if($board_id == '9'){ 
		return $where . "AND `board_id`={$board_id} AND `vote` > 10 AND `view` > 50";
	}
	return $where;
}

add_filter('wpmem_email_filter', 'my_disable_registration_email', 10, 3);
function my_disable_registration_email($arr, $wpmem_fields, $field_data){
	if($arr['toggle'] == 'newreg'){
		$arr['disable'] = true;
	}
	return $arr;	
}

function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);}
}

add_filter('kboard_user_display', 'my_kboard_user_display', 10, 5);
function my_kboard_user_display($user_display, $user_id, $user_name, $plugin, $builder){
	if(in_array($builder->board->id, array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'))
){
		$user = get_userdata($user_id);
		$user_roles = $user->roles;
		
		if(in_array('level_0', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/0.gif">' . $user_display;
		}
		else if(in_array('level_1', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/1.gif">' . $user_display;
		}
		else if(in_array('level_2', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/2.gif">' . $user_display;
		}
		else if(in_array('level_3', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/3.gif">' . $user_display;
		}
		else if(in_array('level_4', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/4.gif">' . $user_display;
		}
		else if(in_array('level_5', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/5.gif">' . $user_display;
		}
		else if(in_array('level_6', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/6.gif">' . $user_display;
		}
		else if(in_array('level_7', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/7.gif">' . $user_display;
		}
		else if(in_array('level_8', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/8.gif">' . $user_display;
		}
		else if(in_array('level_9', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/9.gif">' . $user_display;
		}
		else if(in_array('level_10', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/10.gif">' . $user_display;
		}
		else if(in_array('level_11', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/11.gif">' . $user_display;
		}
		else if(in_array('level_12', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/12.gif">' . $user_display;
		}
		else if(in_array('level_13', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/13.gif">' . $user_display;
		}
		else if(in_array('level_14', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/14.gif">' . $user_display;
		}
		else if(in_array('level_15', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/15.gif">' . $user_display;
		}
		else if(in_array('level_16', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/16.gif">' . $user_display;
		}
		else if(in_array('level_17', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/17.gif">' . $user_display;
		}
		else if(in_array('level_18', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/18.gif">' . $user_display;
		}
		else if(in_array('level_19', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/19.gif">' . $user_display;
		}
		else if(in_array('level_20', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/20.gif">' . $user_display;
		}
		else if(in_array('level_21', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/21.gif">' . $user_display;
		}
		else if(in_array('level_22', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/22.gif">' . $user_display;
		}
		else if(in_array('level_23', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/23.gif">' . $user_display;
		}
		else if(in_array('level_24', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/24.gif">' . $user_display;
		}
		else if(in_array('level_25', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/25.gif">' . $user_display;
		}
		else if(in_array('level_26', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/26.gif">' . $user_display;
		}
		else if(in_array('level_27', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/27.gif">' . $user_display;
		}
		else if(in_array('level_28', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/28.gif">' . $user_display;
		}
		else if(in_array('level_29', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/29.gif">' . $user_display;
		}
		else if(in_array('level_30', $user_roles, true)){
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/30.gif">' . $user_display;
		}
		else{
			$user_display = '<img src="/wp-content/themes/hoot-du/images/icon/30.gif">' . $user_display;
		}
	}
	
	return $user_display;
}

 

위에 코드는 제 function.php 에 들어있는 코드입니다.

 

이것저것 많이 설정해두는 바람에 조금 더러워진 거 같기도 하고.. 꼬여버려서 답답하네요..

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