Skip to content

Instantly share code, notes, and snippets.


Peter Wise petertwise

View GitHub Profile
jchristopher / searchwp-customizations.php
Last active Apr 22, 2021
Give Products extraordinary weight boost to ensure Products show up first.
View searchwp-customizations.php
// Give Products extraordinary weight boost to ensure Products show up first.
// @link
add_filter( 'searchwp\query\mods', function( $mods ) {
$post_type = 'product'; // Post type name.
$source = \SearchWP\Utils::get_post_type_source_name( $post_type );
leepowers / wpseo-yoast-sitemap-custom.php
Last active Aug 9, 2022
WordPress Yoast SEO: Create a custom sitemap with data not sourced from a custom post type.
View wpseo-yoast-sitemap-custom.php
* - Search and replace the `CUSTOM_SITEMAP` string with a lowercase identifier name: e.g., "vehicles", "customer_profiles"
* - The `your_alternate_data_source()` function does not exist; it's simply a placeholder for your own function that returns some sort of data array.
* - Uses heredocs for inline XML:
polevaultweb / acf_pro_license_constant.php
Last active Jul 5, 2022
Define the Advanced Custom Fields Pro license key with a constant
View acf_pro_license_constant.php
function my_filter_acf_pro_license_option( $pre ) {
if ( ! defined( 'ACF_PRO_LICENSE' ) || empty( ACF_PRO_LICENSE ) ) {
return $pre;
$data = array(
'url' => home_url(),
gbot / wp_offload_media_db_migrate.json
Last active Dec 4, 2021
Migrate a WordPress database so that existing media items are served from Amazon S3 or CloudFront. Requires the WP Offload S3 Lite plugin.
View wp_offload_media_db_migrate.json
"use_https": "",
"purge_amazonS3_info": ""
petertwise / youtube-cover-art.php
Last active Jul 31, 2020
Get the best version of youtube cover image without using the API
View youtube-cover-art.php
function url_exists( $url ) {
$headers = get_headers($url);
return stripos( $headers[0], "200 OK" ) ? true : false;
function get_youtube_id( $url ) {
$youtubeid = explode('v=', $url);
$youtubeid = explode('&', $youtubeid[1]);
View sqcdy_acf_rgb.php
Plugin Name: Square Candy ACF RGB color output
Plugin URI:
Description: provides a function to output RGB values from ACF colorpicker fields
Author: Peter Wise
Version: 0.1
Author URI:
macbookandrew / findStyles.js
Last active Sep 8, 2022
List unique CSS properties for all DOM elements
View findStyles.js
* List unique CSS properties for all DOM elements
* Initially created to list unique font stacks on a page
* @see {@link Inspired by this StackOverflow answer}
* @see {@link URL for this file}
* @author AndrewRMinion Design (
* @version 1.1
magicznyleszek /
Last active Nov 25, 2022
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Hi! If you see an error or something is missing (like :focus-within for few years :P) please let me know ❤️

Element selectors

Element -- selects all h2 elements on the page

h2 {
woogist / gist:1128a0803928edc4bd0f
Last active Jun 8, 2020
WooCommerce: change "add to cart" button text by product type
View gist:1128a0803928edc4bd0f
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
* custom_woocommerce_template_loop_add_to_cart
function custom_woocommerce_product_add_to_cart_text() {
global $product;
$product_type = $product->product_type;
ms-studio / wp-gallery-shortcode-override.php
Last active Apr 17, 2019
an override of the default WP gallery shortcote
View wp-gallery-shortcode-override.php