A PHP snippet code to be pasted according to the AI kobee

add_action(‘wp_enqueue_scripts’, function () { if (!is_page(2029)) { return; } wp_enqueue_style( ‘leaflet-css’, ‘https://unpkg.com/[email protected]/dist/leaflet.css’, array(), ‘1.9.4’ ); wp_enqueue_script( ‘leaflet-js’, ‘https://unpkg.com/[email protected]/dist/leaflet.js’, array(), ‘1.9.4’, true ); wp_add_inline_script(‘leaflet-js’, ” document.addEventListener(‘DOMContentLoaded’, function () { const mapElement = document.getElementById(‘treasure-map’); if (!mapElement || typeof L === ‘undefined’) return;…Continue reading

Add Security Headers

function add_security_headers() { header(“Strict-Transport-Security: max-age=31536000; includeSubDomains; preload”); // header(“Content-Security-Policy: default-src ‘self’; img-src ‘self’ data: https:; script-src ‘self’ ‘unsafe-inline’ https:; style-src ‘self’ ‘unsafe-inline’ https:; frame-ancestors ‘self’”); header(“X-Frame-Options: SAMEORIGIN”); header(“X-Content-Type-Options: nosniff”); header(“X-XSS-Protection: 1; mode=block”); header(“Referrer-Policy: strict-origin-when-cross-origin”); header(“Permissions-Policy: camera=(), microphone=(), geolocation=()”); } add_action(‘send_headers’,…Continue reading

Add CC Mail

add_filter(‘wp_mail’, ‘add_cc_to_wp_mail’, 10, 1); function add_cc_to_wp_mail($args) { // Specify the CC email address $cc_email = ‘[email protected]’; // Check if headers are an array or string if (is_array($args[‘headers’])) { $args[‘headers’][] = ‘Cc: ‘ . $cc_email; } else { $args[‘headers’] .= ‘Cc:…Continue reading

Search Council Minutes

// Council Minutes Search – shortcode: [minutes_search] function foliot_minutes_search_shortcode( $atts ) { // Defense-in-depth: even though the containing Page is set to // “Private” (Editor/Admin only) and WPCode’s own Conditional Logic // will also gate this snippet, we check again…Continue reading

Post term count

add_shortcode( ‘term_count’, function( $atts ) { $atts = shortcode_atts( array( ‘taxonomy’ => ”, ‘hide_empty’ => ‘false’, ), $atts, ‘term_count’ ); $taxonomy = sanitize_key( $atts[‘taxonomy’] ); if ( ! $taxonomy || ! taxonomy_exists( $taxonomy ) ) { return ‘0’; } $terms…Continue reading

Huttons News Importer

final class Huttons_News_Importer { private const CRON_HOOK = ‘huttons_news_hourly’; private const CATALOG_URL = ‘https://www.huttonsgroup.com/property-news’; private const MINIMUM_DATE = ‘2026-01-01’; private const POST_TYPE = ‘insight’; private const SOURCE_META = ‘source’; private const ARTICLE_ID_META = ‘_huttons_article_id’; private const LOCK_KEY = ‘huttons_news_import_lock’; public…Continue reading

Manage Admin Menus

function hide_admin_menus() { remove_menu_page( ‘edit.php’ ); // Posts remove_menu_page( ‘upload.php’ ); // Media remove_menu_page( ‘edit-comments.php’ ); // Comments remove_menu_page( ‘themes.php’ ); // Appearance remove_menu_page( ‘plugins.php’ ); // Plugins remove_menu_page( ‘users.php’ ); // Users remove_menu_page( ‘tools.php’ ); // Tools // remove_menu_page(…Continue reading

Soft Catalog Mode & Endpoint Shield

/** * LexiPress: Soft Catalog Mode & Endpoint Shield * Disables purchasing globally and redirects e-commerce endpoints to the homepage. */ if ( ! defined( ‘ABSPATH’ ) ) { exit; } // 1. Globally disable purchasing. This automatically removes all…Continue reading