Skip to content

Instantly share code, notes, and snippets.

View dknauss's full-sized avatar

Dan Knauss dknauss

View GitHub Profile
@dknauss
dknauss / functions.php
Created January 24, 2024 06:02
Unregister default (or any) WordPress taxonomies and remove them from navigation
function nlm_unregister_taxonomies()
{
register_taxonomy('category', array(), array('show_in_nav_menus' => false) );
register_taxonomy('post_tag', array(), array('show_in_nav_menus' => false) );
}
add_action('init', 'nlm_unregister_taxonomies');
@dknauss
dknauss / functions.php
Created February 23, 2017 05:43 — forked from woogist/functions.php
Autocomplete all WooCommerce orders
/**
* Auto Complete all WooCommerce orders.
*/
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) {
if ( ! $order_id ) {
return;
}
$order = wc_get_order( $order_id );
@dknauss
dknauss / define-us-states.php
Last active February 5, 2017 15:21
WooCommerce: Define the list of states customers can order from. Source: https://docs.woocommerce.com/document/addmodify-states/
/**
* Code goes in functions.php or a custom plugin. Replace XX with the country code your changing.
*/
add_filter( 'woocommerce_states', 'custom_woocommerce_states' );
function custom_woocommerce_states( $states ) {
$states['XX'] = array(
'XX1' => 'State 1',
'XX2' => 'State 2'
/**
* Add a 1% surcharge to your cart / checkout
* change the $percentage to set the surcharge to a value to suit
* Uses the WooCommerce fees API
*
* Add to theme functions.php
*/
add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );
function woocommerce_custom_surcharge() {
global $woocommerce;
@dknauss
dknauss / entry-author.php
Created January 30, 2017 02:07
WordPress page template partial for Theme Foundry's Make theme modified to display Co-Authors and Guest Authors created with the Co-Authors Plus plugin.
<?php
/**
* @package Make
*/
// Modified for use with Co-Authors Plus - dan@newlocalmedia - 1-27-17 - Make 1.8.3
$author_key = 'layout-' . make_get_current_view() . '-post-author';
$author_option = make_get_thememod_value( $author_key );
?>
@dknauss
dknauss / pick-a-pic.php
Created April 10, 2015 23:15
Hack the flickr-pick-a-picture plugin media button to work like unsplash-wp
/**
* Adds the pick a pic icon to the media bar.
*
* @param it editor_id.
* @return noting.
**/
function pac_pickapic_media_buttons($editor_id = '') {
echo '<a href="#TB_inline?width=1200&height=800%&inlineId=popup_container"
class="button thickbox unsplash" title="Flickr - Click photos to upload directly to your media library"
// id="' . esc_attr( $editor_id ) . '-add_media" title="' . esc_attr__( 'Flickr', 'pickapic' ) . '" onclick="return false;">
@font-face {
font-family: 'EntypoRegular';
src: url('font/entypo.eot');
src: url('font/entypo.eot?#iefix') format('embedded-opentype'),
url('font/entypo.woff') format('woff'),
url('font/entypo.ttf') format('truetype'),
url('font/entypo.svg#EntypoRegular') format('svg');
font-weight: normal;
font-style: normal;
}