remove_menu('comments'); } // Allow [shortcode] in templates add_action( 'acf/init', 'set_acf_settings' ); function set_acf_settings() { acf_update_setting( 'enable_shortcode', true ); } add_filter( 'acf/shortcode/allow_in_block_themes_outside_content', '__return_true' ); // General Settings - Set Default Featured Image Placeholder if none exists if ( ! class_exists( 'DefaultThumbnailID' ) ) { class DefaultThumbnailID { private static $instance; public function __construct() { // Add the option field to the General page. add_action( 'admin_init', array( &$this, 'show_default_thumbnail_id_option' ) ); // Check if the default featured image exists. add_filter( 'has_post_thumbnail', array( &$this, 'set_has_post_thumbnail_value' ) ); // Display the default featured image. add_filter( 'post_thumbnail_html', array( &$this, 'set_default_post_thumbnail_image' ), 10, 4 ); } public static function get_instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } public function show_default_thumbnail_id_option() { register_setting( 'general', // General page '_default_thumbnail_id' // Option name ); add_settings_field( 'default_thumbnail_id', // ID __( 'Default thumbnail ID', 'text-domain' ), // Option title array( &$this, 'display_input_field' ), // Display callback 'general', // General page 'default' // General page section ); } public function display_input_field() { $value = get_option( '_default_thumbnail_id' ); $value = wp_attachment_is_image( $value ) ? $value : ''; ?>