Skip to content

Instantly share code, notes, and snippets.

@patric-boehner
patric-boehner / gf.php
Last active November 27, 2023 19:28
Set Gravity Forms price field value based on custom field
<?php
// Set product price if dyncialy populate vlaue is set to 'workshop_price'
add_filter( 'gform_field_value_workshop_price', 'cf_custom_product_price', 10, 2 );
function cf_custom_product_price( $value, $field ) {
global $post;
// Get the workshop price
$quantity = get_post_meta( $post->ID, 'workshop_price', true );
@patric-boehner
patric-boehner / ReadMe.md
Created March 20, 2016 00:56
Make forms fields disabled or readonly in Gravity Forms vs Ninja Forms

#Make forms fields disabled or readonly in Gravity Forms vs Ninja Forms

I've seen this in a couple of places so wanted to make a note of it for future use. Their is a plugin from Engage WP that does this a little more agnosticaly then other snippets i have seen that target gravity form class's and id's specificaly. This should work with any wordpress form plugin that allows you to add custom classes to individual form fields.

Simply enqueue this js and enjoy.

@patric-boehner
patric-boehner / social-share.js
Last active December 5, 2022 23:29
Add Simple Custom Social Share Buttons for Genesis
//* This is completly optional. You can leave it off to save some page weight.
/*
* Add to theme/js/dev
* Output to theme/js/social-share.min.js
*/
//* Simpel Social Share Link Popouts
//* http://www.jaredatchison.com/code/create-manual-social-media-share-buttons/
@patric-boehner
patric-boehner / functions.php
Last active September 23, 2022 02:55
Removing in-post settings for the Genesis Framework, including seo, layout and scripts.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
/*
* You can find the refrance for supports that Genesis adds
* in the core files lib > admin > inpost-metaboxes.php
*/
//* Remove Action
@patric-boehner
patric-boehner / Bucket-Properties.md
Last active February 12, 2021 11:36
Amazon AWS S3 User Policy for Updraft Plus

#Bucket Properties for Versioning and Lifecycle

###Versioning

Turn on versioning. This allows us to preserve, reterieve and restore versions of each backup file. This is important incase a backup file is ever overwritten with a bad or corupted file.

###Lifecycle

We will create a lifecycle rule tp ultimelty deal with deleating old backups, since the user we have assigned to updraft can no longer autoamticaly delate old backups based on the plugins settings. For this example I set the limit to 30 days.

@patric-boehner
patric-boehner / ReadMe.md
Last active October 8, 2020 11:37
Customize WordPress Gallery HTML Output

#Customize WordPress Gallery HTML Output


This snippet is for modifying the shortcode and output for Wordpress's built in gallery function HTML. Particularly to modify the stucture for use with the Salvattore & Featherlight jquery to creat a masonary gallery with lightbox as none of the wordpress plugins meet my need. The source of the function is a little out of date compared with the current function Wordpress is using to output the galleries, but meets my needs as I am stripping out most of the markup. Plus I can't seem to get the shortcode_atts assigned in the function to work but thats not a deal breaker. I've updated the php with my new function. Still not sure if this is the best way to go about this but it works well for my need.

I've also added a second if statment to create another modified gallery to create a homepage slideshow using the wordpress agllery function and add suport for the Responsiveslides Jquery plugin.

I am using a conditional statment to check if the

@patric-boehner
patric-boehner / ReadMe.md
Last active March 6, 2020 04:43
Single Post Navigation (Pagination)

#Customize and display links to previous and next post, from a single post


This snippet is for displaying and customizing the links to previous and next posts, for single post entries within the Genesis Framework.

Normally the links to the previous and next post are displayed in the entry footer as the title of the next and previous posts. I wanted to customize the function to swap the link order so that the newest article was accessible from the link on the left and the previous article was accessible form the link on the right, to better navigate posts in an ascending order. I also wanted to add the text "Previous Post" and "next Post" above the linked post titles for better clarification. See the comment in the code for more detail.

For additional customizable permeates, see the codex links under References.

@patric-boehner
patric-boehner / gitignore
Last active March 1, 2020 00:23
A Sample Gitignore file originally from Bill Erickson
# Ignore everything #
**
!wp-content/
wp-content/**
!wp-content/themes/
!wp-content/plugins/
wp-content/themes/**
wp-content/plugins/**
# Add two rules for each Theme or Plugin you want to include:
@patric-boehner
patric-boehner / code-functions.php
Last active July 16, 2019 17:27 — forked from jdelia/code-functions.php
SVG Icons and Graphic Elements
// Add the SVG icons functions.
include_once( get_stylesheet_directory() . '/lib/icon-functions.php' );
@patric-boehner
patric-boehner / inline-svg.php
Created July 4, 2019 01:39
Include inline SVG files.
<?php
function pb_load_inline_svg( $filename ) {
// Add the path to your SVG directory inside your theme.
$svg_path = '/assets/svg/';
$file_end = '.svg';
//Check the SVG file exists
if ( ! file_exists( CHILD_DIR . $svg_path . $filename . $file_end ) ) {