Skip to content

Instantly share code, notes, and snippets.

View BFTrick's full-sized avatar

Patrick Rauland BFTrick

View GitHub Profile
add_action( 'woocommerce_share', 'patricks_woocommerce_social_share_icons', 10 );
function patricks_woocommerce_social_share_icons() {
if ( function_exists( 'sharing_display' ) ) {
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
echo sharing_display();
}
}
@BFTrick
BFTrick / pdf.php
Last active August 25, 2020 21:13
A more customized Ninja Forms PDF Form Submissions template
<?php
/**
* PDF Included With Form Submission
*
* @author Patrick Rauland
* @version 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@BFTrick
BFTrick / pdf.css
Created November 17, 2014 21:59
Some CSS to style the Ninja Forms PDF Form Submissions template
html {
margin: 0;
padding: 0;
}
header {
background-color: #ef4748;
margin-bottom: 20px;
padding: 20px 20px 0 20px;
}
#main {
@BFTrick
BFTrick / pdf-form-with-logo.php
Last active August 10, 2016 21:45
A Ninja Forms PDF Form Submissions template with a logo
<?php
/**
* PDF Included With Form Submission
*
* @author Patrick Rauland
* @version 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@BFTrick
BFTrick / woocommerce-demo-plugin.php
Created October 20, 2014 22:11
A demo WooCommerce plugin
<?php
/**
* Plugin Name: WooCommerce Demo Plugin
* Plugin URI: https://gist.github.com/BFTrick/3ab411e7cec43eff9769
* Description: A WooCommerce demo plugin
* Author: Patrick Rauland
* Author URI: http://speakinginbytes.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
@BFTrick
BFTrick / woocommerce-add-css-to-emails.php
Created October 8, 2014 21:46
Add CSS to WooCommerce Emails
<?php
/**
* Plugin Name: WooCommerce Add CSS to Emails
* Plugin URI: https://gist.github.com/BFTrick/01cc414ee56ce93715ec
* Description: Add CSS styles to WooCommerce emails
* Author: Patrick Rauland
* Author URI: http://speakinginbytes.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
@BFTrick
BFTrick / woocommerce-send-email.php
Last active September 3, 2015 16:03
Send an email when a page loads.
<?php
/**
* Plugin Name: WooCommerce Send Email
* Plugin URI: https://gist.github.com/BFTrick/9bd089bc53b11f7ac3fb
* Description: Send an email when a page loads. Useful for testing email functionality.
* Author: Patrick Rauland
* Author URI: http://speakinginbytes.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
@BFTrick
BFTrick / validate-settings.php
Created July 29, 2014 20:13
Validate your WooCommerce integration settings.
/**
* Validate the API key
* @see validate_settings_fields()
*/
public function validate_api_key_field( $key ) {
// get the posted value
$value = $_POST[ $this->plugin_id . $this->id . '_' . $key ];
// check if the API key is longer than 20 characters. Our imaginary API doesn't create keys that large so something must be wrong. Throw an error which will prevent the user from saving.
if ( isset( $value ) &&
@BFTrick
BFTrick / sanitize-settings.php
Created July 29, 2014 19:43
Sanitize the settings in your WooCommerce Integration
/**
* Init and hook in the integration.
*/
public function __construct() {
// do other constructor stuff first
// Filters.
add_filter( 'woocommerce_settings_api_sanitized_fields_' . $this->id, array( $this, 'sanitize_settings' ) );
@BFTrick
BFTrick / create-custom-setting.php
Created July 29, 2014 17:38
Generate a custom button within the Integration tab.
/**
* Initialize integration settings form fields.
*
* @return void
*/
public function init_form_fields() {
$this->form_fields = array(
// don't forget to put your other settings here
'customize_button' => array(