<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
	<channel>
				<title><![CDATA[최신글 지정등록일 순으로 나오게 하는 방법이 있을까요?]]></title>
		<link>https://www.cosmosfarm.com/threads/rss/document/66793</link>
		<description><![CDATA[<p>1. 상세 내용</p>

<p>kboard 최신글을 제가 지정한 등록일 순으로 나오게 하고 싶은데 방법이 있을까요? </p>

<p>제가 찾아보았을 때 https://www.cosmosfarm.com/threads/document/27474 해당 글이 제가 원하는 기능을 재현하려고 하신 것 같은데요!</p>

<p>해당 글에서 알려주신 코드를 적용하면 작동되지 않아  $board_id == '2' 와 $content_list-&gt;is_latest 를 따로 적용시켜 보았는데요.</p>

<p>이 경우, $board_id == '2' 하나만 적용 했을 때는 해당 기능이 작동이 됐지만</p>

<p>$content_list-&gt;is_latest 하나만 적용했을 때는 작동하지 않습니다.</p>

<p>해당 원인이 무엇일까요?</p>

<p> </p>

<p>2. 코드 내역 </p>

<pre>
<code class="language-php">add_filter('kboard_list_from', 'my_kboard_list_from', 10, 3);
function my_kboard_list_from($from, $board_id, $content_list){
	global $wpdb;
	if($content_list-&gt;is_latest &amp;&amp; $board_id == '2'){
		$from .= " LEFT JOIN `{$wpdb-&gt;prefix}kboard_board_option` ON `{$wpdb-&gt;prefix}kboard_board_content`.`uid`=`{$wpdb-&gt;prefix}kboard_board_option`.`content_uid`";
	}
	return $from;
}

add_filter('kboard_list_where', 'my_kboard_list_where', 10, 3);
function my_kboard_list_where($where, $board_id, $content_list){
	global $wpdb;
	$option_key = 'select_date';
	if($content_list-&gt;is_latest &amp;&amp; $board_id == '2'){
		$where .= " AND (`option_key`='{$option_key}')";
	}
	return $where;
}

add_filter('kboard_list_orderby', 'my_kboard_list_orderby', 10, 3);
function my_kboard_list_orderby($orderby, $board_id, $content_list){
	global $wpdb;
	if($content_list-&gt;is_latest &amp;&amp; $board_id == '2'){
		$orderby = "`{$wpdb-&gt;prefix}kboard_board_option`.`option_value` DESC";
	}
	return $orderby;
}</code></pre>

<p> </p>]]></description>
		<copyright>Copyright 2026, 코스모스팜</copyright>
				<item>
			<title><![CDATA[위에서 문의 드린 후 여러가지 부분을 파악해 보았습니다.

근데, function.php에서  [$content_list-&a...]]></title>
			<link>https://www.cosmosfarm.com/threads/document/66796</link>
			<description><![CDATA[<p>위에서 문의 드린 후 여러가지 부분을 파악해 보았습니다.</p>

<p>근데, function.php에서  [$content_list-&gt;is_latest] 이부분이 제대로 먹히지 않는 것 같습니다.</p>

<p> </p>

<p>제가 이해하기론 [ $content_list-&gt;is_latest ] 해당 코드가 리스트의 최신글을 불러오는 것 같은데, 현재 function.php에서는 불러와 지지 않습니다.</p>

<p>kboard버전, wordpress 버전 모두 가장 최신 버전이며, KBoardBuilder.class.php 에도 최신글 리스트 생성 코드(아래코드)가 아래와 같이 들어 있습니다.</p>

<p> </p>

<p>위 본문내용과 아래 코드내용을 참고하여 빠른 답변 부탁드리겠습니다ㅠㅠ!!</p>

<p> </p>

<p> </p>

<pre>
<code class="language-php">	/**
	 * 최신글 리스트를 생성한다.
	 * @param boolean $with_notice
	 * @param array $args
	 * @return string
	 */
	public function createLatest($with_notice=true, $args=array()){
		ob_start();
		
		$list = new KBContentList($this-&gt;board_id);
		
		if(!is_array($this-&gt;board_id) &amp;&amp; $this-&gt;board-&gt;isPrivate()){
			if(is_user_logged_in()){
				$list-&gt;memberUID(get_current_user_id());
			}
			else{
				$list-&gt;stop = true;
			}
		}

		$list-&gt;is_latest = true; 
		$list-&gt;latest = $args;
		$list-&gt;category1($this-&gt;category1);
		$list-&gt;category2($this-&gt;category2);
		$list-&gt;category3($this-&gt;category3);
		$list-&gt;category4($this-&gt;category4);
		$list-&gt;category5($this-&gt;category5);
		$list-&gt;setSorting($this-&gt;sort);
		$list-&gt;rpp($this-&gt;rpp);
		$list-&gt;setDayOfWeek($this-&gt;dayofweek);
		$list-&gt;setWithinDays($this-&gt;within_days);
		$list-&gt;setRandom($this-&gt;random);
		$list-&gt;setSortRandom($this-&gt;sort_random);
		$list-&gt;getList('', '', $with_notice);
		
		$url = new KBUrl();
		$url-&gt;is_latest = true;
		$url-&gt;setBoard($this-&gt;board);
		$url-&gt;setPath($this-&gt;url);
		
		$vars = array(
			'latest' =&gt; $args,
			'board_url' =&gt; $this-&gt;url,
			'list' =&gt; $list,
			'url' =&gt; $url,
			'skin' =&gt; $this-&gt;skin,
			'skin_path' =&gt; $this-&gt;skin-&gt;url($this-&gt;skin_name),
			'skin_dir' =&gt; $this-&gt;skin-&gt;dir($this-&gt;skin_name),
			'board' =&gt; $this-&gt;board,
			'boardBuilder' =&gt; $this,
		);
		
		echo $this-&gt;skin-&gt;load($this-&gt;skin_name, 'latest.php', $vars);
		
		return ob_get_clean();
	}</code></pre>

<p><br />
<br />
<br />
 </p>]]></description>
			<author>ljm0221</author>
			<pubDate>Thu, 19 Oct 2023 06:28:18 +0000</pubDate>
			<category>KBoard</category>
		</item>
				<item>
			<title><![CDATA[워드프레스는 오픈 소스의 컨텐츠 관리 시스템(CMS)입니다. 웹사이트를 만들고 관리하는 데 사용되며, ...]]></title>
			<link>https://www.cosmosfarm.com/threads/document/66794</link>
			<description><![CDATA[<p>워드프레스는 오픈 소스의 컨텐츠 관리 시스템(CMS)입니다. 웹사이트를 만들고 관리하는 데 사용되며, 사용자 친화적인 인터페이스와 풍부한 플러그인 및 테마 라이브러리를 제공합니다. 워드프레스는 PHP로 작성되었으며 MySQL 또는 MariaDB 데이터베이스를 사용합니다. 워드프레스는 블로그, 기업 웹사이트, 전자상거래 사이트, 포트폴리오 사이트 등 다양한 유형의 웹사이트를 만드는 데 사용될 수 있습니다.</p>]]></description>
			<author>스레드봇 AI</author>
			<pubDate>Thu, 19 Oct 2023 04:44:38 +0000</pubDate>
			<category>KBoard</category>
		</item>
			</channel>
</rss>