단일 게시물 및 페이지에 특성 이미지를 조건부로 표시

설명

Easily control the visibility of the featured image on singular posts and pages–while keeping it visible in archive pages, query loops, and other list views. This plugin provides a simple checkbox option within the post editor, allowing you to enable or disable the display of the featured image on individual posts and pages.

Key Features

  • Show or hide the featured image on singular pages and posts.
  • Seamlessly integrates with the WordPress post editor.
  • Simple checkbox toggle—no technical knowledge needed.
  • Compatible with most themes.
  • Supports WooCommerce product pages.
  • Lightweight and optimized for performance.
  • 100% free—no ads, no upsells, no premium versions!

Perfect for bloggers, content creators, and developers who want precise control over the visibility of featured images on a per-post basis.

Important Notice

If your theme uses a custom method to load the featured image (such as the Twenty Seventeen theme), this plugin may not work. To ensure compatibility, use standard WordPress functions like get_the_post_thumbnail(), wp_get_attachment_image(), or the Post Featured Image block.

Additionally, by default, this plugin only hides the featured image when it is loaded inside the loop. If your theme loads it outside the loop check out the first FAQ entry for a solution.

스크린샷

  • Backend (Block Editor)
  • Frontend (Front Page / Post List / Query Loop Block / Archive View)
  • Frontend (Post / Page / Singular View)
  • Backend (Classic Editor)
  • Backend (WooCommerce Product)

설치

  1. 플러그인 파일을 /wp-content/plugins/conditional-featured-image 디렉토리에 업로드하거나 워드프레스 플러그인 화면을 통해 직접 플러그인을 설치합니다.
  2. 워드프레스의 플러그인 화면을 통해 플러그인을 활성화합니다.

FAQ

The plugin doesn’t work with my theme. What can I do?

Some themes load featured images in custom ways, which may cause compatibility issues. The two most common reasons are:

1) The theme loads the featured image before the loop (e.g., in the header).
2) The theme manually calls the featured image using custom functions.

Solution for case 1

If your theme loads the featured image before the loop, you can modify the plugin’s behavior by adding the following snippet to your functions.php file:

function cybocfi_set_startup_hook() {
    return 'get_header';
}

add_filter( 'cybocfi_startup_hook', 'cybocfi_set_startup_hook' );
add_filter( 'cybocfi_only_hide_in_the_loop', '__return_false' );

Note: This may hide the featured image from other plugins that rely on it, such as SEO plugins or the ‘latest posts’ plugin.

Solution for case 2

If your theme uses custom functions to display featured images, try the following options:

  • Ask the theme developer to use standard WordPress functions like wp_get_attachment_image(), get_the_post_thumbnail() or the_post_thumbnail().
  • Create a child theme and load the featured image with one of the functions above.

이 플러그인은 GDPR을 준수합니까?

Yes! This plugin does not collect, process, or store any personal information, making it fully GDPR-compliant.

특성 이미지를 기본적으로 숨길 수 있나요?

Yes. Add the following code to your functions.php file to hide featured images by default:

add_filter('cybocfi_hide_by_default', '__return_true');

This will automatically check the “Hide Featured Image” option for all new posts and pages. Existing content remains unchanged.

For different default behaviors based on the post type, use:

function cybocfi_set_default_hiding_state( $default, $post_type ) {
    if ( 'post' === $post_type ) {
        $default = true; // Hide featured images on posts by default
    } else if ( 'page' === $post_type ) {
        $default = false; // Show featured images on pages by default
    }
    return $default;
}
add_filter( 'cybocfi_hide_by_default', 'cybocfi_set_default_hiding_state', 10, 2 );

이 플러그인을 게시물로 제한할 수 있습니까(그리고 다른 게시물 유형은 제외할 수 있습니까?)?

Yes. By default, the plugin works on all post types that support featured images. To restrict it to posts only, add the following snippet to your functions.php:

function cybocfi_limit_to_posts( $enabled, $post_type ) {
    if ( 'post' === $post_type ) {
        return $enabled;
    }

    return false;
}
add_filter( 'cybocfi_enabled_for_post_type', 'cybocfi_limit_to_posts', 10, 2 );

If you want it to work for both posts and pages but disable it for other post types:

function cybocfi_limit_to_posts_and_pages( $enabled, $post_type ) {
    $allowed_post_types = array( 'post', 'page' ); // add any post type you want to use the plugin with
    return in_array( $post_type, $allowed_post_types );
}
add_filter( 'cybocfi_enabled_for_post_type', 'cybocfi_limit_to_posts_and_pages', 10, 2 );

WooCommerce: How does the plugin handle product images?

If the featured image is hidden for a WooCommerce product, it will still appear as a thumbnail in the cart, checkout, and product lists. However, it will not be displayed in the single product view. If a product gallery is available, all gallery images will be shown as usual, except for the hidden featured image.

WooCommerce: Can I remove empty space left by the hidden image?

Yes. The plugin applies CSS adjustments automatically for standard themes. If needed, customize it with this snippet:

function cybocfi_woocommerce_styles( $css ) {
    return '.wp-block-woocommerce-product-image-gallery {display: none;}';
}
add_filter( 'cybocfi_woocommerce_style_overrides', 'cybocfi_woocommerce_styles' );

These styles apply only when the featured image is hidden in WooCommerce product pages.

Can I translate this plugin into my language?

Absolutely! You can contribute a translation here. Keep in mind that translations need community approval before they go live.

확인란의 텍스트를 어떻게 변경할 수 있습니까?

You can customize the checkbox label using this filter in your functions.php file:

function cybocfi_set_featured_image_label( $label ) {
    return 'Hide featured image in post'; // change this text
}
add_filter( 'cibocfi_checkbox_label', 'cybocfi_set_featured_image_label' );

I can’t save posts in WordPress 5.7.0

A WordPress core bug (#52787) may cause this issue when another plugin uses post meta values in a specific way. If you see the error “Updating failed. Could not delete meta value from database.”, try:

  • Downgrading to WordPress 5.6.2.
  • Upgrading to WordPress 5.7.1 or later.

I’m getting a deprecation notice. What should I do?

The cybocfi_post_type filter has been replaced with cybocfi_enabled_for_post_type. To update your code:

1) 필터 훅을 cybocfi_post_type에서 cybocfi_enabled_for_post_type으로 변경합니다.
2) 필터 함수 인수를 바꿉니다. $enabled는 이제 첫 번째 인수인 $post_type이고 두 번째 인수입니다.

In case you’ve only used one argument ($post_type), you must not only adapt the function signature, but also add the priority and number of arguments to your add_filter() function call.

Here’s an example:

// BEFORE UPDATE: Using the deprecated filter
function cybocfi_limit_to_posts( $post_type, $enabled ) {
    if ( 'post' === $post_type ) {
        return $enabled;
    }

    return false;
}
add_filter( 'cybocfi_post_type', 'cybocfi_limit_to_posts', 10, 2 );

// AFTER UPDATE: Using the new filter
function cybocfi_limit_to_posts( $enabled, $post_type ) {
    if ( 'post' === $post_type ) {
        return $enabled;
    }

    return false;
}
add_filter( 'cybocfi_enabled_for_post_type', 'cybocfi_limit_to_posts', 10, 2 );

후기

2024년 11월 10일 답글 1개
Thank you so much for creating this plugin. I have been using it for a couple of months and it works superbly. I didn’t think such a plugin would exist since it serves such a niche purpose and was so pleased to have found it and that it just works. It works so simply (just a check box, basically plug and play) and is perfect for my site. For those of you who want to know applications for how this plugin could be used: I have another plugin that displays content on a page using a shortcode, that content already contains an image but that image does not show up in lists of recent posts such as on the home page, so I have to add that image as a featured image in the post that contains the short code. Without this plugin, the page will show two instances of the same image at the same time and would not look so good. This plugin lets me add a featured image to a post, display it anywhere that lists recent posts for visual purposes, but then hide it on the actual page itself so only the image from the shortcode shows. Perfect.
2024년 8월 20일 답글 1개
For some reason, CSS to hide featured image wasn’t working, this plugin did the trick… Thanks so much!
2024년 7월 23일 답글 1개
Plug and play, straight forward, just works. Works on Wordpress 6.6, maybe it doesn’t need to be updated that often. Thank you for such a simple fix to a niche request!
2024년 4월 6일
Finally. A plug-in that just works. Thank you for making my headache go away.
2024년 1월 26일
В некоторых темах просто не работает совсем. Галочку ставишь — эффекта нуль.
모든 38 평가 읽기

기여자 & 개발자

“단일 게시물 및 페이지에 특성 이미지를 조건부로 표시”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

“단일 게시물 및 페이지에 특성 이미지를 조건부로 표시”(이)가 4 개 언어로 번역되었습니다. 기여해 주셔서 번역자님께 감사드립니다.

자국어로 “단일 게시물 및 페이지에 특성 이미지를 조건부로 표시”(을)를 번역하세요.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하세요.

변경이력

3.3.1

  • Fixed violation of the WordPress coding standards

3.3.0

  • Added support for WooCommerce
  • Fixed bottom margin deprecation notice
  • 업데이트된 종속성

3.2.0

  • 워드프레스 6.6 이상 필요
  • 워드프레스 6.7까지 호환성
  • withState 사용 중단 공지 수정
  • 업데이트된 종속성

3.1.1

  • 구텐베르크 16.6.0과 호환
  • 업데이트된 종속성

3.0.1

  • 쿼리를 설정할 수 없도록 시작 훅을 사용자 지정한 사용자의 치명적인 오류를 수정합니다.

3.0.0

  • 블록 편집기와의 호환성 개선
  • 업데이트된 종속성

이번 릴리스는 철저한 테스트를 거쳤지만 사용 중인 테마와 플러그인에 따라 일부 예외적인 경우에 문제가 발생할 수 있습니다.

2.14.0

  • 특성 이미지는 이제 쿼리 블록 안에 표시됩니다.
  • 작은 성능 및 가독성 개선
  • 업데이트된 종속성

2.13.0

  • 블록 테마에 대한 향상된 호환성
  • cybocfi_enabled_for_post_type 필터는 이제 프런트엔드의 출력에도 직접 적용됩니다.
  • 단일 파일에서 파일당 단일 클래스로 리팩터링된 플러그인 아키텍처
  • 업데이트된 종속성

2.12.0

  • OEmbed 요청에서 특성 이미지를 숨기지 마세요.
  • 업데이트된 종속성

2.11.0

  • cybocfi_post_type 필터가 사용되는 경우 지원 중단 알림을 표시합니다. apply_filters_deprecated()에 주의를 기울인 @swissspidy에게 제안합니다.

2.10.0

  • 새로운 cybocfi_enabled_for_post_type 필터를 위해 더 이상 사용되지 않는 cybocfi_post_type 필터. cybocfi_post_type의 문제를 강조한 @swissspidy에게 제안합니다.
  • 업데이트된 종속성

2.9.0

  • In_the_loop() 테스트를 우회하는 필터를 추가하여 플러그인이 기본 루프 외부의 특성 이미지를 로드하는 테마와 호환되도록 만들 수 있습니다.

2.8.2

  • 최신 게시물 위젯에서 특성 이미지를 숨기던 버그를 수정했습니다. 이것을 지적한 @molcsa에게 제안합니다.
  • 업데이트된 종속성

2.8.1

  • 확장된 FAQ
  • 업데이트된 종속성
  • 워드프레스 5.8.2까지 테스트

2.8.0

  • 조기 초기화를 위한 후크 추가
  • 확장된 FAQ
  • 소규모 리팩토링
  • 업데이트된 종속성

2.7.1

  • 워드프레스 5.7까지 테스트
  • 업데이트된 종속성

2.7.0

  • Custom Post Type UI 플러그인에 대한 지원 추가
  • 업데이트된 종속성

2.6.0

  • Twentynineteen 테마에 대한 지원 추가

2.5.1

  • 수정: 기본 쿼리 이후에 실행된 쿼리에서 특성 이미지를 제거하지 마십시오.
  • 업데이트된 종속성

2.5.0

  • 프로그래밍 방식으로 추가된 게시물에 대한 cybocfi_hide_by_default 필터를 준수합니다.
  • 소규모 리팩토링
  • 워드프레스 5.6.0까지 테스트
  • 업데이트된 종속성

2.4.0

  • 기본적으로 특성 이미지를 숨기는 필터를 추가했습니다.
  • 워드프레스 5.5.1까지 테스트
  • 확장된 FAQ
  • 업데이트된 종속성

2.3.1

  • 워드프레스 5.5(RC1)까지 테스트됨
  • 확장된 FAQ
  • 업데이트된 종속성

2.3.0

  • 게시물 유형별로 플러그인을 활성화/비활성화하도록 허용

2.2.0

  • 특성 이미지 체크박스 라벨 필터링 허용
  • 읽어보기 업데이트
  • 종속성 업데이트

2.1.2

  • SVN에서 필수 데이터를 제외하지 않음

2.1.1

  • 종속성 업데이트

2.1.0

  • Yoast SEO 지원 추가(소셜 헤더 데이터에 대한 이미지 필터링 안 함)

2.0.0

  • 블록 편집기(구텐베르크)에 대한 지원 추가
  • 워드프레스 5.2.2까지 테스트

1.4.0

  • 메인 포스트만 수정합니다.
  • 워드프레스 5.0.0까지 테스트

1.3.0

  • 엘리멘터에서도 작동하도록 더 강력하게 만드세요.
  • 워드프레스 4.9.6까지 테스트

1.2.2

  • 워드프레스 4.7.3까지 테스트
  • 워드프레스 4.8.0까지 테스트
  • 워드프레스 4.9.0까지 테스트

1.2.1

  • 워드프레스 4.7.2까지 테스트

1.2.0

  • 언어 팩 준비(플러그인 폴더 이름과 동일한 텍스트 도메인 설정, load_plugin_textdomain 제거)

1.1.3

  • 워드프레스 4.7.0까지 테스트
  • 언어 폴더를 제거했습니다. 언어는 이제 wordpress.org에서 로드됩니다.

1.1.2

  • 플러그인 제목 개선
  • 확인란 문자열 개선
  • 문서 개선
  • 안정적인 태그 업데이트됨

1.1.1

  • 안정적인 태그 업데이트됨

1.1

  • 페이지로 확장된 기능

1.0

  • 최초 공개