Skip to content

Instantly share code, notes, and snippets.

@marstamyan
marstamyan / functions.php
Created November 23, 2024 09:40
Load Contact Form 7 styles and scripts only on specific pages
<?php
function disable_cf7_assets_except_some_pages() {
$allowed_pages = ['contact'];
if (!is_page($allowed_pages)) {
wp_dequeue_style('contact-form-7');
wp_deregister_style('contact-form-7');
wp_dequeue_script('contact-form-7');
wp_deregister_script('contact-form-7');
@marstamyan
marstamyan / access_code_verification.php
Created February 12, 2024 15:22
This file checks user-entered access codes for validity, granting access if the code is correct, and prompting for re-entry if incorrect.
<?php
// Check if a valid access code has been submitted
if (isset($_POST['access_code'])) {
$stored_hash = 'a891af9b4934fe765b5778469d1f1f45'; // Replace with your actual MD5 hash
$entered_code = $_POST['access_code'];
$entered_hash = md5($entered_code); // Hash the entered code
if ($entered_hash === $stored_hash) {
// Display your link