1. Home
  2. Docs
  3. WordPress Tips & Tri...
  4. is_blog() – 컨디션 체크

is_blog() – 컨디션 체크

워드프레스의 기본 포스트 타입 글(post)에 대해, 블로그 홈, 목록, 싱글 페이지까지 글(post)과 관련된 콘텐츠인지 한번에 체크 가능한 컨디션 체크 방법을 추가

function is_blog () {
    global  $post;
    $posttype = get_post_type($post );
    return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post')  ) ? true : false ;
}