Skip to content

Instantly share code, notes, and snippets.

View saltnpixels's full-sized avatar

Eric saltnpixels

View GitHub Profile
if ( ! function_exists( 'set_tag_cloud_sizes' ) ) {
/**
* Removes the inline font sizing.
*
* @param string $tags holds markup of tags
*
* @return string
*/
function set_tag_cloud_sizes( string $tags ): string {
return preg_replace( '/style="font-size: \d+pt;"/', '', $tags );
@saltnpixels
saltnpixels / entry-content.css
Created June 2, 2021 18:36
Centered Content for WP Blocks
.entry-content,
.article-footer,
.after-article {
padding-left: var(--spacing-20);
padding-right: var(--spacing-20);
&::after {
clear: both;
content: "";
}
@saltnpixels
saltnpixels / gform_stripe_subscriptions.php
Created October 10, 2017 15:25
Gravity forms stripe cancel from front end
<?php
/**
* Payment subscriptions and updating billing and cancelling subscriptions takes place with these hooks
* We need the stripe customer user id for updating billing
* we need the entry id of subscription so we can cancel it.
*/
/**
* @param $entry
@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 = '';