Skip to content

Instantly share code, notes, and snippets.

@gaambo
gaambo / acf.js
Last active December 29, 2021 18:11
ACF Block with Innerblocks
import { Fragment } from "@wordpress/element";
import { InnerBlocks } from "@wordpress/editor";
/**
* Changes the edit function of an ACF-block to allow InnerBlocks
* Should be called like this on `editor.BlockEdit` hook:
* ` addFilter("editor.BlockEdit", "namespace/block", editWithInnerBlocks("acf/block-name"));`
*
* @param {string} blockName the name of the block to wrap
* @param {object} innerBlockParams params to be passed to the InnerBlocks component (like allowedChildren)
<?php
/**
* Index WooCommerce Product Variations
*/
// Add product variations to the list of post types to index
function my_searchwp_indexed_post_types( $post_types ) {
if ( ! in_array('product_variation', $post_types ) ) {
$post_types = array_merge( $post_types, array( 'product_variation' ) );
@CurtisL
CurtisL / .htaccess
Last active March 27, 2024 01:57
Better Maintenance Mode .htaccess rules
# BEGIN MAINTENANCE MODE
# ADD your IP address to gain access. Local IPS for local testing
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^192\.168\.0\.0
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /maintenance.html [R=503,L]
@helgatheviking
helgatheviking / add-taxonomy-to-woocommerce-export.php
Last active March 4, 2024 14:51
Add a custom taxonomy to WooCommerce import/export
<?php
/*
* Plugin Name: WooCommerce Add Taxonomy to Export
* Plugin URI: https://gist.github.com/helgatheviking/114c8df50cabb7119b3c895b1d854533/
* Description: Add a custom taxonomy to WooCommerce import/export.
* Version: 1.0.1
* Author: Kathy Darling
* Author URI: https://kathyisawesome.com/
*
* Woo: 18716:fbca839929aaddc78797a5b511c14da9
@anschaef
anschaef / bootstrap-4-sass-mixins-cheat-sheet.scss
Last active April 12, 2024 08:49
Bootstrap 4 Sass Mixins [Cheat sheet with examples]
/* -------------------------------------------------------------------------- */
// All Bootstrap 4 Sass Mixins [Cheat sheet]
// Updated to Bootstrap v4.5.x
// @author https://anschaef.de
// @see https://github.com/twbs/bootstrap/tree/master/scss/mixins
/* -------------------------------------------------------------------------- */
/*
// ########################################################################## */
// New cheat sheet for Bootstrap 5:
@AustinGil
AustinGil / functions.php
Last active September 14, 2020 11:56
JSON-LD for WordPress posts
/**
* Remove hentry from post_class
* This is important to not get schema errors
*/
function visceral_remove_hentry_class( $classes ) {
$classes = array_diff( $classes, array( 'hentry' ) );
return $classes;
}
add_filter( 'post_class', 'visceral_remove_hentry_class' );
@amboutwe
amboutwe / yoast_seo_opengraph_change_image_size.php
Last active January 11, 2024 20:48
Code snippet to change or remove OpenGraph output in Yoast SEO. There are multiple snippets in this code.
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change size for Yoast SEO OpenGraph image for all content
* Credit: Yoast Development team
* Last Tested: May 19 2020 using Yoast SEO 14.1 on WordPress 5.4.1
* Accepts WordPress reserved image size names: 'thumb', 'thumbnail', 'medium', 'large', 'post-thumbnail'
* Accepts custom image size names: https://developer.wordpress.org/reference/functions/add_image_size/
*/
@chancesmith
chancesmith / notification-bar-set-cookie.html
Created November 7, 2016 20:11
Bootstrap alert top notification bar + cookie set after closed
@robneu
robneu / facet-wp-infinite-scroll.js
Last active October 9, 2021 22:26
Infinite scroll for FacetWP
/* globals FWP */
/**
* JavaScript for FacetWP Infinite Scroll
*/
(function( $ ) {
'use-strict';
var throttleTimer = null;
var throttleDelay = 100;
@JasonHoffmann
JasonHoffmann / gforms_styles.css
Created September 13, 2016 03:22
gravityforms-bootstrap4
.btn > .caret, .gform_button > .caret,
.dropup > .btn > .caret,
.dropup > .gform_button > .caret {
border-top-color: #000 !important;
}
.gform_fields {
padding-left: 0;
list-style: none;
margin-left: -15px;