Skip to content

Instantly share code, notes, and snippets.

View saltnpixels's full-sized avatar

Eric saltnpixels

View GitHub Profile
@saltnpixels
saltnpixels / button-arrow.svg
Last active May 12, 2021 17:22
svg Animate from within
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@saltnpixels
saltnpixels / svg_allowed_html
Last active May 10, 2021 19:22
Get SVG File in php
function get_svg_allowed_html() {
$allowed_html = [
'svg' => [
'fill' => true,
'height' => true,
'width' => true,
'xmlns' => true,
'viewbox' => true,
'class' => true,
'transform' => true,
@saltnpixels
saltnpixels / containers.css
Created April 28, 2021 20:17
WordPress Containers CSS
/*------- Three types of Containers --------*/
.container {
margin: auto;
max-width: var(--container);
padding-left: var(--container-padding);
padding-right: var(--container-padding);
width: 100%;
}
.container-fluid {
:root {
--fs-base: 1.6rem;
--fs-m: 1.8rem;
--fs-s: 1.4rem;
}
p {
margin: 1rem 0 0 0;
}
@saltnpixels
saltnpixels / base-layout.css
Last active April 28, 2021 16:29
CSS Base Layout
html {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
font-size: 62.5%;
}
body {
font-size: 1.6rem;
-webkit-font-smoothing: antialiased;
@saltnpixels
saltnpixels / get_svg_icon.php
Last active April 27, 2021 20:44
WP Get SVG icon in php from a symbol set
<?php
/**
* Icons Support with symbols to hold all icons in one file
* Simply add icons to the assets folder and run npm run icons
* This will create a symbol-defs.svg in dist with svg's
* symbol file will remove colors and fills.
*
*
* @package ignition
*/
@saltnpixels
saltnpixels / gf_validate_file.php
Created December 17, 2020 18:18
Gravity Forms Validate Uploaded File
add_filter( 'gform_validation', 'custom_validation' );
function custom_validation( $validation_result ) {
$form = $validation_result['form'];
foreach ( $form['fields'] as $field ) {
if ( strpos( $field->cssClass, 'myfileclass' ) !== false ) {
$input = 'input_' . $field->id;
$uploaded_files = json_decode( rgpost( "gform_uploaded_files" ) );
$is_file_uploaded = isset( $uploaded_files->$input );
$filename = '';
@saltnpixels
saltnpixels / wordPress_spreadsheet.php
Created December 8, 2020 17:24
WordPress Excel Spreadsheet
//add the php spreadsheet library via composer interminal
composer require phpoffice/phpspreadsheet
//put function in theme in WP. Use the get_spreadsheet on a file to get the file like a csv. Works on xlsx
function get_spreadsheet($filepath) {
require get_template_directory() . '/vendor/autoload.php'; //if not using wp remove get_template_directory()
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filepath);
$worksheet = $spreadsheet->getActiveSheet();
$worksheet = $spreadsheet->getActiveSheet();
@saltnpixels
saltnpixels / index.js
Last active July 15, 2020 19:03
Ignition Installer
#!/usr/bin/env node
const { spawn } = require('child_process')
const chalk = require('chalk')
const args = require('minimist')(process.argv)
let folder = args._[2] || './'
console.log(chalk.blue('Downloading Ignition Starter Theme'))
@saltnpixels
saltnpixels / membership_meta.php
Last active November 3, 2022 19:55
adding membership meta to rcp from ACF
<?php
/*--------------------------------------------------------------
# Saving Features to Membership Levels from an acf repeater field for RCP Pro
--------------------------------------------------------------*/
function some_feature_list( $level ) {
/**
* @var RCP_Levels $rcp_levels_db
*/
global $rcp_levels_db;