Skip to content

Instantly share code, notes, and snippets.

View theimageyard's full-sized avatar

Jon Dennis theimageyard

View GitHub Profile
@theimageyard
theimageyard / add-javascript-warning.php
Created February 17, 2018 19:25
Add Javascript Warning
add_action( 'wp_footer', 'add_noscript_warning' );
function add_noscript_warning () { ?>
<noscript>
<div style="
font-family: sans-serif;
position: fixed;
bottom: 0;
@theimageyard
theimageyard / unload-wordpress-plugins.php
Last active June 25, 2020 09:12
Dynamically Unload Wordpress Plugins
/*
** Use this function to remove an array of plugins from being loaded
**/
add_filter( 'option_active_plugins', 'enable_plugins_selectively' );
function enable_plugins_selectively( $plugins ) {
// Use add_query_arg to get the current URL.
// You can use any other valid method that suits.
@theimageyard
theimageyard / customise-woocommerce-product-category-taxonomy.php
Created November 23, 2015 21:52
CUSTOMISE WOOCOMMERCE PRODUCT CATEGORY TAXONOMY
//
// CUSTOMISE WOOCOMMERCE PRODUCT CATEGORY TAXONOMY
//
// Requires WooCommerce to be installed.
// ------------------------------------------------------------------------------------
// A simple method to make changes to the mames of standard WooCommerce taxonomies.
// Just replace <my new name> with the text you want to use:
// e.g. For the taxonomy 'Product Category' (product_cat/prod_cat)
// you could use 'Photoshoots' if you just sold Photographs etc.
// or 'Ranges' if that is better than Product Categories
@theimageyard
theimageyard / add-custom-menu-to-wp-admin-bar.php
Last active February 16, 2018 21:26
Woocommerce Tips - Add Custom Links to WP Admin Bar
// Add a custom menu to the Admin Bar instead of the boring Visit Site (and Visit Store if you use WooCommerce).
// Also opens the links in a new window which is even more helpful.
//
// Author: Jon Dennis
// AuthorURI: http://www.theimageyard.co.uk
if ( is_admin() ) {
add_action( 'wp_before_admin_bar_render', 'remove_admin_bar_links' );