Custom setting to show or hide field

I’ve got a custom post type (Places), and that post type has a custom field to indicate that the Place is a participant in a holiday-season promotion. I would like to create a setting somewhere so that I could set the begin and end date of the promotion, and then be able to show or hide that field.

For now I have to manually edit templates when the promotion begins and ends, but I’d prefer to adjust it from a settings page in the admin screen. Is this possible?

Roughly this:

if ( is_place() ) :
if ( is_date( wp_setting( ‘promotion_dates’ ) ) :
echo ‘Promotion’;
endif;
endif;

Read more here:: Custom setting to show or hide field

Leave a Reply

Your email address will not be published. Required fields are marked *