Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bitfade
bitfade / gist:4555047
Last active January 21, 2022 03:06
WordPress - Remove empty p tags for custom shortcodes
<?php
add_filter("the_content", "the_content_filter");
function the_content_filter($content) {
// array of custom shortcodes requiring the fix
$block = join("|",array("col","shortcode2","shortcode3"));
// opening tag
10 Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
8 Cannot read property \'type\' of undefined
7 Cannot read property \'replace\' of undefined
6 The object can not be found here.
5 Failed to execute \'insertBefore\' on \'Node\': The node before which the new node is to be inserted is not a child of this node.
5 Cannot set property \'onload\' of null
5 Cannot read property \'unbind\' of undefined
4 Cannot read property \'tagName\' of undefined
3 Failed to execute \'removeChild\' on \'Node\': The node to be removed is not a child of this node.
3
@bitfade
bitfade / gist:ee91d7e8aff16364b9ff
Created March 2, 2015 14:11
Custom WordPress Media Uploader
(function ($) {
"use strict";
/*global wp,jQuery */
var CustomGalleryEdit,CustomFrame;
function customClasses() {
var media = wp.media;
var l10n = media.view.l10n;
@bitfade
bitfade / filter.js
Last active October 5, 2018 18:09
WordPress 3.5 media upload, toolbar with custom filter
/*jslint undef: false, browser: true, devel: false, eqeqeq: false, bitwise: false, white: false, plusplus: false, regexp: false, nomen: false */
/*global wp,jQuery */
jQuery(document).ready(function($) {
if (!window.wp || !window.wp.media) {
return;
}
var media = window.wp.media;
@bitfade
bitfade / change.jsx
Created September 27, 2017 15:15
range change
componentDidUpdate: function ( prevProps ) {
// update value state on preview mode change or value changed (via props) by another component
if ((this.props.previewMode && this.props.previewMode !== prevProps.previewMode) || this.props.value !== prevProps.value) {
this.setState({
value: this.emptyIfDefault(this.getCurrentInputValue()),
});
}
},
@bitfade
bitfade / gist:4460948
Last active April 3, 2017 07:58
WordPress 3.5 media upload api example
var workflow = wp.media({
title: 'Select the images',
// use multiple: false to disable multiple selection
multiple: 'add',
button: {
text: 'Add selected images'
},
library: {
type: 'image'
}
/*
Author: bitfade
this class will convert a XML configuration in to a simpler object
*/
package bitfade.utils {
import flash.xml.*
public class XmlParser {
@bitfade
bitfade / init.el
Last active August 29, 2015 14:22
Easy motion bug test
(require 'package)
(package-initialize)
(require 'evil)
(require 'evil-easymotion)
(evil-mode 1)
(evilem-default-keybindings "SPC")