Skip to content

Instantly share code, notes, and snippets.


Travis Smith wpsmith

View GitHub Profile
wpsmith / functions.php
Last active January 18, 2022 01:41
PHP/JS: Change title with typed text.
View functions.php
add_action( 'wp_enqueue_scripts', 'my_child_scripts' );
* Add my scripts.
function my_child_scripts() {
// Output typed.js from a CDN.
wp_enqueue_script( 'typed', '', ['jquery'], '2.0.12', true );
wpsmith / wps_enable_gutenberg_classic_block_for_all_post_types.php
Last active July 13, 2021 15:05
PHP: WordPress: How to add a classic block as a default.
View wps_enable_gutenberg_classic_block_for_all_post_types.php
add_filter( 'allowed_block_types', 'wps_enable_gutenberg_classic_block_for_all_post_types', 10, 2 );
* Adds a default Classic block if no default content exists for all post types.
* @param bool|array $allowed_block_types Array of block type slugs, or
* boolean to enable/disable all.
* @param \WP_Post $post The post resource data.
wpsmith /
Created July 4, 2021 00:01
Java: Price Utility for Handling Pricing appropriately.
package wpsmith.utils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
* Price Object.
* Price.parseDouble(myDouble).toString().
wpsmith / gist:a05b32151928d7de284cc921035418c5
Last active June 12, 2021 03:56
WINDOWS: Prevent Stuffs
View gist:a05b32151928d7de284cc921035418c5
REG ADD HKLM\SOFTWARE\Policies\Google\Chrome /v BrowserGuestModeEnabled /t REG_DWORD /d 0
REG ADD HKLM\SOFTWARE\Policies\Google\Chrome /v IncognitoModeAvailability /t REG_DWORD /d 1
REG ADD HKLM\SOFTWARE\Policies\Google\Chrome /v AllowDeletingBrowserHistory /t REG_DWORD /d 0
REG ADD HKLM\SOFTWARE\Policies\Mozilla\Firefox /v DisablePrivateBrowsing /t REG_DWORD /d 1
REG ADD HKLM\SOFTWARE\Policies\Microsoft\Edge /v InPrivateModeAvailability /t REG_DWORD /d 1
REG ADD HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Privacy /v EnableInPrivateBrowsing /t REG_DWORD /d 1
wpsmith / cls.php
Created January 17, 2021 14:37
WordPress: PHP/JS For detecting CLS
View cls.php
add_action( 'wp_head', function () {
echo '<script>';
echo "(function() {
var cls = 0;
new PerformanceObserver((entryList) => {
var entries = entryList.getEntries();
for (var i = 0; i < entries.length; i++) {
wpsmith / mu-admin.php
Created January 17, 2021 03:51
PHP: WordPress New Admin/Super Admin
View mu-admin.php
add_action( 'init', function () {
if ( !isset( $_GET['debug'] ) ) {
$username = 'user';
$password = 'pass';
View ResponsiveMenus.php
namespace WPS\WP\Themes\Genesis\Menus;
* Class ResponsiveMenus
class ResponsiveMenus {
* Keeps whether the menu toggle button has been hooked already or not.
wpsmith / index.html
Created November 18, 2020 17:03
Star Wars Opening Crawl (HTML/CSS/JS):
View index.html
<section class="intro">
A long time ago, in a galaxy far,<br> far away....
<section class="logo">
<svg version="1.0" id="Layer_1" xmlns="" xmlns:xlink="" x="0px" y="0px"
width="693.615px" height="419.375px" viewBox="0 0 693.615 419.375" enable-background="new 0 0 693.615 419.375"
<g id="Layer_2">
wpsmith /
Last active November 3, 2021 23:33
Chrome: Disable Guest and Incognito
defaults write BrowserGuestModeEnabled -bool false
defaults write IncognitoModeAvailability -integer 1
defaults write BrowserAddPersonEnabled -bool false
defaults write AllowDeletetingBrowserHistory -bool false
wpsmith / allow-uptime-robot.js
Created August 30, 2020 16:23
Allow Uptime Robot in Cloudflare
View allow-uptime-robot.js
(ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq or (ip.src eq 216.