Skip to content

Instantly share code, notes, and snippets.

Avatar

Dade Maru dademaru

View GitHub Profile
@gaambo
gaambo / acf.js
Last active May 29, 2020
ACF Block with Innerblocks
View acf.js
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)
View functions.php
<?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' ) );
@helgatheviking
helgatheviking / add-taxonomy-to-woocommerce-export.php
Last active Jul 27, 2020
Add a custom taxonomy to WooCommerce import/export
View add-taxonomy-to-woocommerce-export.php
<?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 Aug 12, 2020
Bootstrap 4 Sass Mixins [Cheat sheet with examples]
View bootstrap-4-sass-mixins-cheat-sheet.scss
/* -------------------------------------------------------------------------- */
// 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
/* -------------------------------------------------------------------------- */
// Grid variables
$grid-columns: 12;
$grid-gutter-width: 30px;
@Stegosource
Stegosource / functions.php
Last active Jul 13, 2020
JSON-LD for WordPress posts
View functions.php
/**
* 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 Jul 29, 2020
Code snippet to change or remove OpenGraph output in Yoast SEO. There are multiple snippets in this code.
View yoast_seo_opengraph_change_image_size.php
<?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 Nov 7, 2016
Bootstrap alert top notification bar + cookie set after closed
View notification-bar-set-cookie.html
@robneu
robneu / facet-wp-infinite-scroll.js
Last active Apr 8, 2019
Infinite scroll for FacetWP
View facet-wp-infinite-scroll.js
/* globals FWP */
/**
* JavaScript for FacetWP Infinite Scroll
*/
(function( $ ) {
'use-strict';
var throttleTimer = null;
var throttleDelay = 100;
@JasonHoffmann
JasonHoffmann / gforms_styles.css
Created Sep 13, 2016
gravityforms-bootstrap4
View gforms_styles.css
.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;
@kirandash
kirandash / Gravity Forms + Bootstrap
Created Jul 14, 2016
Helpful function for adding Bootstrap classes to Gravity Forms fields.
View Gravity Forms + Bootstrap
<?php
/**
* Gravity Forms Bootstrap Styles
*
* Applies bootstrap classes to various common field types.
* Requires Bootstrap to be in use by the theme.
*
* Using this function allows use of Gravity Forms default CSS
* in conjuction with Bootstrap (benefit for fields types such as Address).
*
You can’t perform that action at this time.