Skip to content

Instantly share code, notes, and snippets.

@darinronne
darinronne / gf-disable-days.js
Last active March 4, 2024 21:41
Gravity Forms disable days
gform.addFilter( 'gform_datepicker_options_pre_init', function( optionsObj, formId, fieldId ) {
// Form ID and Field ID
if ( formId == 2 && fieldId == 6 ) {
optionsObj.firstDay = 0;
optionsObj.beforeShowDay = function(date) {
let dayOfWeek = date.getDay();
let today = new Date();
// let today = new Date('2024-03-09T15:00:00');
// If the current day is Saturday,
@darinronne
darinronne / html-post-processing-rule.md
Last active July 7, 2020 22:35
WP Engine HTML Post-Processing Rule - wp_get_attachment_image_src()

The WP Engine CDN doesn't apply to images that are output via wp_get_attachment_image_src().

<?php echo esc_url( wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' )[0] ); ?>

You can add a HTML Post-Processing rule that will get them. (Found in the site's WP admin: WP Engine > General Settings)

Replace SITE_URL and UNIQUE_CDN_STRING.

@darinronne
darinronne / functions.php
Created June 30, 2020 15:32
Filter Canonical URL for paginated pages - Wordpress, Yoast
/**
* Filter Canonical URL for paginated pages.
*
* @param string $canonical The current page's generated canonical URL.
*
* @return string The filtered canonical URL.
*/
function filter_wpseo_canonical( $canonical ) {
$a = '/page/';
if ( strpos( $canonical, $a ) !== false ) {
@darinronne
darinronne / fancy-gallery.js
Last active June 4, 2020 14:28 — forked from erikyo/fancy-gallery.js
fancybox 3 integration into wordpress Gutenberg gallery block
@darinronne
darinronne / _wp-block-gallery.scss
Created April 29, 2020 13:34
Wordpress Gutenberg Gallery Block Gutter Styles
@darinronne
darinronne / st-hidden-characters.md
Last active August 5, 2019 18:50
Finding Hidden Character in SublimeText that is copied from another file.

With RegEx option selected, search for:

[^\x00-\x7F]
@darinronne
darinronne / acf-additional-organization-schema.php
Last active June 9, 2023 12:54
Additional Organization Schema Data when using Yoast and ACF in Wordpress
<?php
/**
* ACF Additional Organization Schema Data
*
* Inserts "Alternate Organization Names" into the existing Organization JSON that Yoast creates.
* And creates new Location Schema JSON that is added to HEAD of the site.
* Tags: ACF, Advanced Custom Fields, Yoast, SEO, Local, Locations, Schema, Wordpress
*
* @package Meta13_Functionality
* @since 1.0.0
@darinronne
darinronne / _gravity-forms.scss
Last active November 28, 2018 16:45
Gravity Forms styles for use with a Zurb Foundation 6 based theme.
/*------------------------------------*\
#GRAVITY-FORMS
\*------------------------------------*/
// GF styles don't play nice with Foundation, so this is to try and fix those things.
@darinronne
darinronne / echo_print_r.sublime-snippet
Last active November 19, 2018 17:25
Sublime Text Snippet: Echo print_r
<snippet>
<content><![CDATA[
echo '<pre>';
print_r( ${1} );
echo '</pre>';
die;
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>epr</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@darinronne
darinronne / nginx-gzip.md
Last active May 10, 2018 15:41
Enable gzip on nginx

Apache & nginx Settings for site.com

Additional nginx directives

gzip_proxied any;
gzip on;
gzip_disable "MSIE [1-6]\\.(?!.*SV1)";
gzip_comp_level 5;
gzip_types text/plain text/css application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/bmp image/svg+xml;
gzip_vary on;