Skip to content

Instantly share code, notes, and snippets.

View justinswelch's full-sized avatar

Justin Welch justinswelch

View GitHub Profile
/**
* Remove inlined styles from target selector
* removeInlineStyles(targetSelector)
*
* @param {string} targetSelector (valid css selector)
* @return {null}
*/
const removeInlineStyles = function (targetSelector) {
try {
document.createDocumentFragment().querySelector(targetSelector)
<?php
/**
*-----------------------------------------------------------
* Add publisher logo/image schema for Beaver Builder plugin
*-----------------------------------------------------------
*
* Filter: 'fl_schema_meta_publisher_image_url'
* Defined in: bb-plugin/modules/post-grid/post-grid.php
*
@justinswelch
justinswelch / beaverbuilder-random-layout-shortcode.php
Created August 10, 2018 00:50
Shortcode that displays a random saved BB layout on each page refresh.
<?php
/**
* Plugin Name: PXB - Random Beaver Layouts
* Description: Show random saved layouts in BB with shortcode
* Version: 1.0
* Author: Pixablaze
* Author URI: https://www.pixablaze.com
*/
/*----------------------------------------------------------
@justinswelch
justinswelch / keybase.md
Created August 9, 2018 00:14
public keybase verification

Keybase proof

I hereby claim:

  • I am justinswelch on github.
  • I am justinwelch (https://keybase.io/justinwelch) on keybase.
  • I have a public key ASC2J4oo7OOLdG_cUUoaM-Hb9FczRzsDfiuLLVayPNgNpwo

To claim this, I am signing this object:

<?php
/*------------------------------------------------
Track email click from GF notification
The link in the GF notification would use form entry values as query vars like:
<a href="https://example.com/confirmation-page/?rsvp=1&eid={entry_id}"> Click here to RSVP</a>
The full GF notification url the user clicks looks like:
https://example.com/confirmation-page/?rsvp=1&&eid=1
------------------------------------------------
@justinswelch
justinswelch / gulp-task-copy-npm-frontend-deps.js
Last active July 31, 2018 19:57
Gulp task to copy NPM frontend dependencies from node_modules to ./dist/js/vendor/
/*-----------------------------------------------------
* Copy NPM front-end dependencies to ./dist/
*
* Tested with:
* Node: v10.6.0
* NPM: 6.2.0
* Gulp: 4.0.0-alpha.3 (and CLI 2.0.3)
*----------------------------------------------------*/
gulp.task( 'copy-npm-deps', function ( done ) {
// store public dependencies from package.json into variable
@justinswelch
justinswelch / pxb-gravitypdf-import-pdf.php
Created July 31, 2018 01:06
Class for Gravity Forms + GravityPDF to append external PDF after creating GPDF
<?php
namespace PXGPDF;
use GPDFAPI;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/*------------------------------------------------
* Class: PXB_Append_PDF
<?php
// Log Beaver Builder status notes to js console
// Reference: /bb-plugin/classes/class-fl-builder-model.php
add_action( 'wp_footer', 'pxb_log_bb_status_to_console' );
function pxb_log_bb_status_to_console() {
if( ! WP_DEBUG ) return;
// defaults
$bb_status = array(
'enabled_status' => 'not enabled',
'active_status' => 'not active',
<?php
/**
* Customized archive template
* Intended to be used in a child theme as index.php
* Outputs a Beaver Builder posts module for archive pages
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package pixablaze_base
*/