Skip to content

Instantly share code, notes, and snippets.

@devinsays
devinsays / tracking.php
Created April 24, 2020 15:49
Tracking Copy
<?php
/**
* Add GTM ecommerce tracking to the Order Complete (Thank You) page.
*
* @param int $order_id
*/
public function thank_you_tracking($order_id)
{
$user_id = get_current_user_id();
$is_existing_customer = $user_id ? get_user_meta($user_id, '_existing_customer', true) : false;
@devinsays
devinsays / svg-icon-post.md
Last active May 27, 2021 10:37
How to Use an SVG for a Custom Post Type Icon

Let's use this id-card svg for the custom post type icon rather than a standard dashicon.

First, download the raw SVG file. If you open it up in a text editor, it should look something like this:

<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="id-card" class="svg-inline--fa fa-id-card fa-w-18" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M528 32H48C21.5 32 0 53.5 0 80v16h576V80c0-26.5-21.5-48-48-48zM0 432c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V128H0v304zm352-232c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16zm0 64c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16zm0 64c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16zM176 192c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zM67.1 396.2C75.5 370.5 99.6 352 128 352h8.2c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h8.2c28.4 0 52.5 18.5
@alexmustin
alexmustin / block-style-variations.js
Created August 5, 2020 19:08
WP - Add block style variations
jQuery(document).ready(function($) {
// Add 'Semibold' style to Paragraph blocks
wp.blocks.registerBlockStyle("core/paragraph", {
name: "semibold",
label: "Semibold"
});
// Add 'Black' style to Paragraph blocks
wp.blocks.registerBlockStyle("core/paragraph", {
@Webreaper
Webreaper / docker-compose.yml
Last active April 25, 2025 23:48
Sample Docker-compose file which shows how to set up Sonarr, Radarr, Prowlarr, Lidarr, QBittorrent and a VPN container so that all all traffic from the containers is routed through the VPN. Also includes Plex and get_iplayer containers, which are not routed through the VPN.
# Docker compose to set up containers for all services you need:
# VPN
# Sonarr, Radarr, Lidarr, Qbittorrent
# Non-VPN
# Plex, get_iplayer
# Before running docker-compose, you should pre-create all of the following folders.
# Folders for Docker State:
# /volume1/dockerdata. - root where this docker-compose.yml should live
# /volume1/dockerdata/plex - Plex config and DB
# /volume1/dockerdata/sonarr - Sonarr config and DB
@doubleedesign
doubleedesign / acf-tsf-integration.php
Last active December 9, 2022 13:06
Get meta descriptions in The SEO Framework from ACF flexible content fields
<?php
/**
* The SEO Framework + ACF flexible content integration
* TSF will look at the excerpt and then the content to generate the default meta description.
* If both of those are empty, this code looks for ACF flexible modules to get it from.
* // TODO: Make this work with archives as well as posts
* @param $description
* @param $args
*
* @return mixed|string
@bluewalk
bluewalk / GetNordVPNWireGuardDetails.md
Last active April 29, 2025 08:31
Getting NordVPN WireGuard details

About

Instructions to obtain WireGuard details of your NordVPN account. These can be used to setup a WireGuard tunnel on your router to NordVPN.

Source: https://forum.gl-inet.com/t/configure-wireguard-client-to-connect-to-nordvpn-servers/10422/27

Prerequisites

If you have any linux machine, use that or install a vm if you don't have one.

Get their official linux app installed. Make sure you have wireguard installed too. And set the used technology to Nordlynx by running nordvpn set technology nordlynx

@eddychilakiller
eddychilakiller / data-table.js
Last active November 29, 2024 08:20
Data table
$(document).ready(function() {
var table = $('#example').DataTable( {
ajax: "data/data.json",
lengthMenu: [ 20, 50 ],
pagingType: "full_numbers",
initComplete: function() {
$('.dataTables_filter input').unbind();
var input = $('.dataTables_filter input').unbind(),
self = this.api(),
$searchButton = $('<button>')
@petertwise
petertwise / acf-install-license
Last active April 8, 2025 11:21 — forked from polevaultweb/acf_pro_license_constant.php
Define the Advanced Custom Fields Pro license key with a constant
#!/bin/bash
# Setup ACF Pro to use a license key in wp-config
#
# 1. Place your license key in a file called .acf-license-key somewhere your ssh user has access to it.
# Default is in your home directory: ~/.acf-license-key
# Change the setting below if you need to put it somewhere else
# 2. install this file in /usr/local/bin or someplace in your PATH
# 3. make sure you have WP CLI installed
# 4. run acf-install-license from the root of your wordpress install
@andberry
andberry / jquery-document-ready-vanilla-javascript.js
Last active October 26, 2021 09:37
jQuery $(document).ready() in vanilla JavaScript
/*
https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event
- The DOMContentLoaded event fires when the initial HTML document has been completely loaded and parsed,
without waiting for stylesheets, images, and subframes to finish loading.
- A different event, load, should be used only to detect a fully-loaded page.
https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState
- loading: The document is still loading.
- interactive: The document has finished loading and the document has been parsed but sub-resources such as scripts, images, stylesheets and frames are still loading.
- completeThe document and all sub-resources have finished loading. The state indicates that the load event is about to fire.
@taskylizard
taskylizard / fmhy.md
Last active April 28, 2025 02:27
/r/freemediaheckyeah, in one single file (view raw)