Skip to content

Instantly share code, notes, and snippets.

@2ndkauboy
2ndkauboy / comments-of-private-posts.php
Last active March 13, 2021 23:50
Show comments from private posts in the comments widget
<?php
/**
* Comments of private posts
*
* @package copp
* @author Bernhard Kau
* @license GPLv3
*
* @wordpress-plugin
* Plugin Name: Comments of private posts
@2ndkauboy
2ndkauboy / google-analytics-for-wordpress-security-fix.php
Created February 13, 2021 22:03
Add the HTTPS protocol to the Google Tag Manager path if it is path relative.
<?php
/**
* Google Analytics for WordPress Security Fix
*
* @package gafwsf
* @author Bernhard Kau
* @license GPLv3
*
* @wordpress-plugin
* Plugin Name: Google Analytics for WordPress Security Fix
<?php
/**
* Deletion Prevention
*
* @package pec
* @author Bernhard Kau
* @license GPLv3
*
* @wordpress-plugin
* Plugin Name: Deletion Prevention
@2ndkauboy
2ndkauboy / gf_dynamic.js
Created October 6, 2020 11:01 — forked from gicolek/gf_dynamic.js
Gravity Forms dynamic reload
<script type="text/javascript">
// let's make call to the global gwrf variable visible after enabling Gravity Forms
window.gwrf;
(function ($) {
gwrf = function (args) {
// prototype arguments, created when we instantiate it
this.formId = args.formId;
this.spinnerUrl = args.spinnerUrl;
@2ndkauboy
2ndkauboy / wordcamp-automatic-timezone-converter-code.js
Last active September 27, 2020 07:49
A bookmarklet to convert time zones on a WordCamp schedule
timeZone = wp.date.__experimentalGetSettings().timezone.abbr;
for( let time of document.querySelectorAll('.wcpt-time') ) {
let date = new Date(time.innerHTML.replace(/(\d+:\d+)(&nbsp;(pm|am))?/, `${new Date().toLocaleDateString([],{ year: 'numeric', month: 'long', day: 'numeric' })} $1 $3 ${timeZone}`));
time.innerHTML = (`${time.innerHTML}<br/><span style="white-space: nowrap;">${new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit', timeZoneName:'short'})}</span>`);
}
<?php
/**
* Reusable Blocks Management
*
* @package Reusable_Block_Management
* @author Bernhard Kau
* @license GPLv3
*
* @wordpress-plugin
* Plugin Name: Reusable Blocks Management
@2ndkauboy
2ndkauboy / sun-info.sh
Created January 8, 2020 14:33
Sun Info with PHP
#!/usr/bin/bash
php -r 'setlocale(LC_TIME, "de_DE.UTF-8"); date_default_timezone_set("Europe/Berlin"); print_r(array_map(function($time){ return strftime("%c", $time); }, date_sun_info(time(), 52.3918, 13.1126)));'
<?php
/**
* Unique Title Checker Across Post Types
*
* @package unique-title-checker-across-post-types
* @author Bernhard Kau
* @license GPLv3
*
* @wordpress-plugin
* Plugin Name: Unique Title Checker Across Post Types
<?php
/**
* Unique Title Checker Errors Only
*
* @package unique-title-checker
* @author Bernhard Kau
* @license GPLv3
*
* @wordpress-plugin
* Plugin Name: Unique Title Checker Errors Only
<?php
/**
* Capitalize ẞ Dangit
*
* @package CapitalizeẞDangit
* @author Bernhard Kau
* @license GPLv3
*
* @wordpress-plugin
* Plugin Name: Capitalize ẞ Dangit