게시판 리스트 제목지정

안녕하세요, 게시판에 글을 쓸때마다 제목을 고정으로 만들 수 있나요?

예를 들면 모든 글의 제목을 "이 글은 비밀글입니다." 라고

게시판 리스트에 나오게 하고 싶습니다.

방법을 알려주신다면 대단히 감사하겠습니다 ^^

워드프레스 에러 기술지원 서비스 전문가에게 맡기세요
좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기
  • 아래 링크에 답변 남겨드렸습니다.

    https://www.cosmosfarm.com/threads/document/42260

  • 안녕하세요 

    다름이 아니라 공지사항을 제회하고 모든 글을 비밀글로 쓰고 싶은데 

    코드를 어떻게 해야되는지 설명 가능하실까요?

  • 안녕하세요~^^

    KBoard 플러그인에서 모든 게시글의 제목을 같은 문구로 표시하시려면

    1. /wp-content/plugins/kboard/class/KBContent.class.php 파일에

    아래의 코드를 찾아서

    public function __get($name){
    	if(isset($this->row->{$name})){
    		if(in_array($name, array('title', 'content'))){
    			if(isset($this->row->status) && $this->row->status == 'pending_approval' && in_array(kboard_mod(), array('list', 'document'))){
    				if($this->isEditor()){
    					switch($name){
    						case 'title': return apply_filters('kboard_pending_approval_title', sprintf(__('[Pending] %s', 'kboard'), $this->row->title), $this); break;
    						case 'content': return apply_filters('kboard_pending_approval_content', sprintf(__('<p>&#91;Waiting for administrator Approval.&#93;</p>%s', 'kboard'), $this->row->content), $this); break;
    					}
    				}
    				else{
    					switch($name){
    						case 'title': return apply_filters('kboard_pending_approval_title', __('&#91;Pending&#93; Waiting for administrator Approval.', 'kboard'), $this); break;
    						case 'content': return apply_filters('kboard_pending_approval_content', __('&#91;Waiting for administrator Approval.&#93;', 'kboard'), $this); break;
    					}
    				}
    			}
    		}
    		return $this->row->{$name};
    	}
    	return '';
    }

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

    public function __get($name){
    	$value = '';
    	if(isset($this->row->{$name})){
    		if(in_array($name, array('title', 'content'))){
    			if(isset($this->row->status) && $this->row->status == 'pending_approval' && in_array(kboard_mod(), array('list', 'document'))){
    				if($this->isEditor()){
    					switch($name){
    						case 'title': return apply_filters('kboard_pending_approval_title', sprintf(__('&#91;Pending&#93; %s', 'kboard'), $this->row->title), $this); break;
    						case 'content': return apply_filters('kboard_pending_approval_content', sprintf(__('<p>&#91;Waiting for administrator Approval.&#93;</p>%s', 'kboard'), $this->row->content), $this); break;
    					}
    				}
    				else{
    					switch($name){
    						case 'title': return apply_filters('kboard_pending_approval_title', __('&#91;Pending&#93; Waiting for administrator Approval.', 'kboard'), $this); break;
    						case 'content': return apply_filters('kboard_pending_approval_content', __('&#91;Waiting for administrator Approval.&#93;', 'kboard'), $this); break;
    					}
    				}
    			}
    		}
    		$value = $this->row->{$name};
    	}
    	return apply_filters('kboard_content_value', $value, $name, $this);
    }

    위의 코드는 추후 KBoard 플러그인에 반영해서 업데이트할 예정입니다.

     

    2. 워드프레스 관리자 -> 외모 -> 테마 편집기 페이지에서 functions.php 파일 하단에

    아래의 코드를 추가해보시겠어요?

    add_filter('kboard_content_value', 'my_kboard_content_value', 10, 3);
    function my_kboard_content_value($value, $name, $content){
    	$board = $content->getBoard();
    	
    	if($name == 'title' && $board->id == '1'){ // 실제 게시판 id로 적용해주세요.
    		$value = '이 글은 비밀글입니다.';
    	}
    
    	return $value;
    }

    위의 코드에서 $board->id == '1' 부분은 실제 게시판 id로 적용해보시겠어요?

    고맙습니다.

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