Skip to content

Instantly share code, notes, and snippets.

View danieljwonder's full-sized avatar
💻

Daniel Wonder danieljwonder

💻
View GitHub Profile
@danieljwonder
danieljwonder / greeter.sol
Created December 8, 2018 20:49
Ethereum Greeter Updated from v4
pragma solidity ^0.5.0;
contract mortal {
/* Define variable owner of the type address */
address owner;
/* This function is executed at initialisation and sets the owner of the contract */
constructor() public { owner = msg.sender; }
/* Function to recover the funds of the contract */
@danieljwonder
danieljwonder / wp-config.php
Created December 4, 2018 20:16
Run WordPress Updates, WordPress Plugin Updates, and WordPress Theme Updates Automatically
<?php
/*
* Select one or more of the options below to your wp-config.php file to have WordPress updates run automatically.
*/
// Apply Major WordPress Updates Automatically
define( 'WP_AUTO_UPDATE_CORE', true );
// Apply Minor WordPress Updates Automatically
@danieljwonder
danieljwonder / functions.php
Created November 20, 2018 03:12
Cheatsheet for customising the WordPress Login page
<?php
// Cheatsheet for customising the WordPress Login page
function my_custom_login() {
echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/login/ENTER_URL.css" />';
}
add_action('login_head', 'my_custom_login');
function my_login_logo_url() {
return get_bloginfo( 'url' );
@danieljwonder
danieljwonder / functions.php
Created November 20, 2018 01:09
Selectively Send Gravity Forms Notifications in Plain Text
<?php
// Send Gravity Form notifications in plain text when Notification is called `Plain Text Notification`
add_filter( 'gform_notification', 'change_notification_format', 10, 3 );
function change_notification_format( $notification, $form, $entry ) {
GFCommon::log_debug( 'gform_notification: change_notification_format() running.' );
// Do the thing only for a notification with the name `Plain Text Notification`
if ( $notification['name'] == 'Plain Text Notification' ) {
GFCommon::log_debug( 'gform_notification: format changed to text.' );
// Change notification format to text from the default html
@danieljwonder
danieljwonder / functions.php
Created November 20, 2018 00:14
Delete Gravity Form Entries After Submission
<?php
// Delete Gravity Form Entries for form ID 1 after submission.
// Switch action to `gform_after_submission` to target all forms.
add_action( 'gform_after_submission_1', 'remove_form_entry' );
function remove_form_entry( $entry ) {
GFAPI::delete_entry( $entry['id'] );
}
@danieljwonder
danieljwonder / twiml.xml
Created November 7, 2018 09:16
TwiML Bin: Enable SIP for Outgoing Calls via Twilio
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial callerId="+TWILIO_NUMBER">{{#e164}}{{To}}{{/e164}}</Dial>
</Response>
@danieljwonder
danieljwonder / twiml.xml
Created November 7, 2018 09:13
TwiML Bin: Enable SIP for Incoming Calls via Twilio
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Sip>
USERNAME@SIP_DOMAIN.sip.us1.twilio.com
</Sip>
</Dial>
</Response>
@danieljwonder
danieljwonder / functions.php
Created November 6, 2018 01:48
Enable Archive Settings for multiple Custom Post Types via Genesis
<?php
// Enable Archive Settings for multiple Custom Post Types via Genesis
$types = array('custom-post-type-1', 'custom-post-type-2');
foreach ( $types as $type ) {
add_post_type_support( $type, 'genesis-cpt-archives-settings' );
}
@danieljwonder
danieljwonder / functions.php
Created October 30, 2018 09:43
Register Theme Support for Gutenberg Wide Images
<?php
/**
* Register Theme Support for Gutenberg Wide Images
*/
function enable_wide_images() {
add_theme_support( 'align-wide' );
}
add_action( 'after_setup_theme', 'enable_wide_images' );
@danieljwonder
danieljwonder / portfolio-headlines.php
Created September 25, 2018 02:46
Add Portfolio Headlines to WordPress Categories
<?php
/* Add Portfolio Headlines to WordPress Categories */
function addPortfolioHeadlineFieldsToCat(){
$portfolio_headline = get_term_meta($_GET['tag_ID'], '_portfolio_headline', true);
$portfolio_sub_headline = get_term_meta($_GET['tag_ID'], '_portfolio_sub_headline', true);
?>
<h2><?php _e('Portfolio Headline Settings'); ?></h2>
<table class="form-table">
<tbody>