Skip to content

Instantly share code, notes, and snippets.

View herbie4's full-sized avatar
🏠
Working from office

herbert herbie4

🏠
Working from office
View GitHub Profile
@herbie4
herbie4 / hhdev-popupmaker-custom-hide-close-countdown.html
Last active September 22, 2022 08:38
Popupmaker plugin: set a auto close time with countdown and option to hide this popup for 1 month, cookie based.
<!-- add this directly into the popup screen of WordPress popupmaker plugin, might need some css styling. -->
<div id="close-auto-text"></div>
<a class="popmake-close pum-close news-popup-close" href="#" onclick="setPUMcookie();">Click here to hide this popup for 1 month.</a>
<code><script>function setPUMcookie() { var CookieDate = new Date;
CookieDate.setFullYear(CookieDate.getFullYear());
document.cookie = "pum-4830=true; expires=' + CookieDate.toUTCString() + '; path=/";}
var timeLeft = 30; var elem = document.getElementById('close-auto-text');
var timerId = setInterval(countdown, 1000);
function countdown() {
if (timeLeft == -1) {
@herbie4
herbie4 / hhdev-wp-redir-all-emails-on-staging.php
Created June 29, 2023 12:23
Bedrock mu-plugin: redirect all emails to specified email when on staging environment. Change the email as needed!
<?php
// Bedrock mu-plugin: redirect all emails to developer email on staging site
// Don't forget to set your email address!
add_filter( 'wp_mail', 'hhdev_staging_email_filter', 10, 1 );
function hhdev_staging_email_filter( $args ) {
if (getenv('WP_ENV') == 'staging') {
@herbie4
herbie4 / hhdev-2fa-set-email-2fa-all-users.php
Created August 8, 2023 17:25
HHdev Force 2fa email for all users. Use as mu-plugin. Needs the https://wordpress.org/plugins/two-factor/ plugin to be active.
<?php
/**
* Plugin Name: HHdev Force 2fa email for all users
* Version: 1.0.1
* Description: Needs 2FA plugin to work. Forces alle users to 2fa with email.
* Plugin URI: https://haha.nl/wordpress-plug-in-op-maat/
*/
/*
There is also an open issue for enabling 2FA for all users which includes a temporary solution for doing that through a filter:
@herbie4
herbie4 / hhdev-remove-wpdl-rss-feed.php
Created March 12, 2024 15:45
wp-downloadmanager: remove download rss feed
<?php
// add to child theme functions.php
// remove download rss feed
// wp-downloadmanager - lester chan
add_action( 'wp_head', 'hhdev_remove_action', 5 );
function hhdev_remove_action() {
remove_action('wp_head', 'download_rss_link');
}