Skip to content

Instantly share code, notes, and snippets.

View davidwolfpaw's full-sized avatar

david wolfpaw davidwolfpaw

View GitHub Profile
@davidwolfpaw
davidwolfpaw / EDD_download_pre-restricted
Created August 4, 2014 15:21
Make pages automatically checked private in EDD, and select specific download buyers to restrict to
// Make pages automatically checked private in EDD, and select specific download buyers to restrict to
// Change val("86") to the option that you want pre-selected
add_action( 'admin_head', 'pw_edd_cr_admin_head', 20 );
function pw_edd_cr_admin_head() {
echo '<script type="text/javascript">jQuery(function($){ $("#edd_cr_active_only").attr("checked", "1"); $("#edd_cr_download_id").val("86"); });</script>';
}
@davidwolfpaw
davidwolfpaw / dynamic_date_dropdown_gravityforms.php
Created August 23, 2016 19:06
Dynamically generate list of dates in Gravity Forms Dropdown and remove past and previously selected dates
<?php
/*
* Dynamically generate list of dates in Gravity Forms Dropdown and remove past and previously selected dates
*/
add_filter( 'gform_pre_render', 'dl_populate_dropdown' );
//Note: when changing drop down values, we also need to use the gform_pre_validation so that the new values are available when validating the field.
add_filter( 'gform_pre_validation', 'dl_populate_dropdown' );
@davidwolfpaw
davidwolfpaw / gf_si_int.php
Created September 8, 2016 16:05
Gravity Forms / Sprout Invoices Pro Integration
/**
* Hook into all Gravity Form submissions, check to see if the form id
* matches the one we want to generate an invoice from, and process the
* submission if appropriate.
*
* @param arrat $entry Array of the GF entry
* @return null
*/
function maybe_process_gravity_form_and_create_invoice( $entry = array(), $form = array() ) {
@davidwolfpaw
davidwolfpaw / class-cc-post-republisher-admin.php
Created August 3, 2017 13:20
settings page options for ccpr
/**
* Initializes the general settings by registering the Sections, Fields, and Settings.
*
* This function is registered with the 'admin_init' hook.
*/
public function initialize_general_settings() {
// Control title of republish
// Set Terms text
// Choose CC license to use
@davidwolfpaw
davidwolfpaw / genesis_post_link_shortcode.php
Created September 8, 2018 18:37
This is a custom shortcode to allow the link to a post while using the Genesis Framework for WordPress
<?php
/*
* This is a custom shortcode to allow the link to a post while using the Genesis Framework.
*
* It was created to fill the need of a loop that needed links to posts.
*/
add_shortcode( 'post_link', 'genesis_post_link_shortcode' );
/**
@davidwolfpaw
davidwolfpaw / wp-cli_site-setup.sh
Created November 9, 2018 20:40
A sample WP-CLI script to setup a new site with some defaults of our choosing.
#!/bin/zsh
# delete the default plugins and themes that we don't need
wp plugin delete hello
wp theme delete twentyfifteen
wp theme delete twentysixteen
# install the themes and plugins that we do want
wp plugin install gutenberg --activate
wp plugin activate akismet
@davidwolfpaw
davidwolfpaw / wp_custom_install.sh
Created January 31, 2017 19:01
A starter script for creating a WordPress site on Vagrant using VVV, VV, VASSH, and WP-CLI
#!/bin/bash -e
# Ideas, Drawbacks, and Suggestions: https://davidlaietta.com/bash-scripting-to-automate-site-builds-with-wp-cli/
# Set up some defaults
wpuser='USERNAME'
email='USER@EMAIL.COM'
blueprint='BLUEPRINT-NAME'
clear
@davidwolfpaw
davidwolfpaw / davids-youtube-cleanup.css
Created March 26, 2024 13:30
david's YouTube Cleanup Stylesheet for Stylus
/* ==UserStyle==
@name david's YouTube Cleanup
@namespace github.com/openstyles/stylus
@version 1.0.0
@description Various Options to Cleanup YouTube. You can toggle display of full video titles, blurring out watched videos, hiding a bunch of sidebar buttons, and some body cruft, including YouTube Shorts.
@author david wolfpaw
@preprocessor stylus
@var checkbox show-full-titles "Show Full Titles" 1
@var checkbox hide-watched-videos "Blur Watched Videos" 1
@davidwolfpaw
davidwolfpaw / gravity-forms-confirmation-remain.php
Last active April 1, 2024 06:26
Keep Gravity Forms Displayed After Submission
<?php
// Allow the Gravity form to stay on the page when confirmation displays.
add_filter( 'gform_pre_submission_filter', 'dw_show_confirmation_and_form' );
function dw_show_confirmation_and_form( $form ) {
// Inserts a shortcode for the form without title or description
$shortcode = '[gravityform id="' . $form['id'] . '" title="false" description="false"]';
// Ensures that new lines are not added to HTML Markup
ob_start();