最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Custom setting to show or hide field

programmeradmin1浏览0评论

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;

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论