Checkbox Code To Add or Remove Featured Image

This code adds a checkbox to enable or disable the featured image from displaying on single posts and pages.

No plugin needed.

By default, the code adds the featured image on single posts if the featured image is checked on the Genesis > Theme Settings > Content Archive settings.

content-archives

You can then remove the image simply by ticking a checkbox located below the wp editor on all Edit Post screens like this:

image-checkbox

The code also enables you to change the position the image displays so you can move it to after the entry title or any other genesis hook location.

Demo Video

Works in any Genesis child theme.

Installation

Step 1: Simply add the following line of PHP code to the end of your child themes functions file:

include_once( get_stylesheet_directory() . '/featured-image-checkbox.php' );

Step 2: Download the featured-image-checkbox.php file below and upload it to your child themes root directory.

Here’s the featured-image-checkbox.php file for logged in members:

Related Code


Comments

4 responses to “Checkbox Code To Add or Remove Featured Image”

  1. Hi Brad,
    thank you for this tutorial. Unfortunately it doesn’t work here. There is also a plugin called ‘Hide Featured Image’ that won’t work either.
    Don’t know why. I disabled a lot of 3rd-party-plugins, but without any effect on this problem.
    Have you an idea to solve this?

    kind regards
    Rainer

    site: https://www.official.jungvital.com

    1. Brad Dalton Avatar
      Brad Dalton

      Hi

      I’ll take a look on Monday however i do test all code and know it works.

      You will need to read the entire tutorial in case you have missed something.

      The video also proves it works. I cannot access your code from the front end.

      1. thank you, Brad.
        If you like to look at backend:
        https://www.jungvital.com/wp-login.php
        admin: Adonais-son
        login: VdF5jdi$EITR2Mlfk0GEDOXa

        1. Brad Dalton Avatar
          Brad Dalton

          Only works in Genesis. Looks like you have a non Genesis theme active.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.