Skip to content

Instantly share code, notes, and snippets.

View deckerweb's full-sized avatar
🏠
Working from home

David Decker deckerweb

🏠
Working from home
View GitHub Profile
@deckerweb
deckerweb / functions.php
Created June 1, 2018 12:24 — forked from leepettijohn/functions.php
Add Event to The Events Calendar from a Gravity Form
//The following section is an add-on to this tutorial - https://tri.be/gravity-forms-events-calendar-submissions/
//Shout to CreativeSlice.com for their initial work
/* Before Starting:
- Make sure you have these three plugins installed
- Gravity Forms
- The Events Calendar
- Gravity Forms + Custom Post Types
- Once Gravity Forms is installed, create a form with these fields
- Single Line Text (Event Title)
- Paragraph Text (Event Description)
@deckerweb
deckerweb / auto-dark-mode.php
Created April 19, 2018 20:59
Lets you enable Dark Mode automatically between certain times. Requires Dark Mode plugin version 2.0 or later.
<?php
/**
* Plugin Name: Automatic Dark Mode
* Plugin URI: https://github.com/danieltj27/Dark-Mode/
* Description: Lets your users make the WordPress admin dashboard darker.
* Author: Daniel James
* Author URI: https://www.danieltj.co.uk/
* Text Domain: auto-dark-mode
* Version: 1.0
@deckerweb
deckerweb / genesis-open-graph.php
Created April 19, 2018 15:02 — forked from bradonomics/genesis-open-graph.php
Adding Open Graph Meta Tags to the Genesis Theme Head
<?php
//* Call the First Image in a Post (Used in the Open Graph Call Below)
function catch_first_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
@deckerweb
deckerweb / collapse_sections.php
Created March 14, 2018 14:31 — forked from SJ-James/collapse_sections.php
Add a 'Collapse Section' button to the Elementor Editor
<?php
//Add to functions.php in child theme
function e_collapse_sections(){
?>
<!-- Scripts and styles should enqueued properly but for the sake of having it all in one function...-->
<script>
if ( self !== top ) { // Check if we're in a preview window / iframe
jQuery(document).ready(function($){
// = Max File Size =
// =================
define( 'AI1WM_MAX_FILE_SIZE', 536870912 * 8 );
@deckerweb
deckerweb / customizer-links.php
Created March 12, 2018 19:30 — forked from slushman/customizer-links.php
How to link into the WordPress Customizer
@deckerweb
deckerweb / plugin-settings.php
Created March 3, 2018 13:55 — forked from annalinneajohansson/plugin-settings.php
A base for a WordPress plugin settings page, using the Settings API #add_options_page #add_action #admin_init #register_setting #add_settings_section
<?php
# http://kovshenin.com/2012/the-wordpress-settings-api/
# http://codex.wordpress.org/Settings_API
add_action( 'admin_menu', 'my_admin_menu' );
function my_admin_menu() {
add_options_page( __('My Plugin Options', 'textdomain' ), __('My Plugin Options', 'textdomain' ), 'manage_options', 'my-plugin', 'my_options_page' );
}
add_action( 'admin_init', 'my_admin_init' );
@deckerweb
deckerweb / pliim-turnOff.scpt
Created January 10, 2018 08:58 — forked from zehfernandes/pliim-turnOff.scpt
One click and be ready to go up on stage and shine! - https://zehfernandes.github.io/pliim/
# Turn on Notifications
do shell script "defaults -currentHost write com.apple.notificationcenterui doNotDisturb -bool FALSE; defaults -currentHost delete com.apple.notificationcenterui doNotDisturbDate; osascript -e 'quit application \"NotificationCenter\" ' && killall usernoted" -- this set 'Do not disturb' to false in the pref
# Show Desktop
do shell script "defaults write com.apple.finder CreateDesktop -bool true; killall Finder"
# Show all windows
tell application "System Events"
set visible of (every process) to true
end tell
@deckerweb
deckerweb / use-email-for-login-woocommerce.php
Created January 10, 2018 08:14 — forked from JustinSainton/use-email-for-login-woocommerce.php
Use the submitted email address for the username in WooCommerce registration.
<?php
add_filter( 'woocommerce_new_customer_data', function( $data ) {
$data['user_login'] = $data['user_email'];
return $data;
} );
@deckerweb
deckerweb / functions.php
Created April 17, 2017 19:39 — forked from ChrisCree/functions.php
Add the Shop page breadcrumb to single products and archives for WooCommerce pages with the Genesis framework. Code below can be added to your child theme's functions.php file. Then go to Genesis --> Theme Settings and ensure the Breadcrumbs settings for Posts and Archives is enabled. PLEASE NOTE: This code assumes the Genesis Connect for WooCom…
<?php
// Do not copy opening PHP tag above
// Add the Shop page to Genesis breadcrumbs in WooCommerce
// NOTE: Assumes Genesis Connect for WooCommerce plugin is active
add_filter( 'genesis_archive_crumb', 'wsm_prepend_shop_link', 11, 2 );
add_filter( 'genesis_single_crumb', 'wsm_prepend_shop_link', 11, 2 );
function wsm_prepend_shop_link( $crumb, $args ) {
if ( is_singular( 'product' ) || is_tax( 'product_cat' ) || is_tax( 'product_tag' ) ) {