Skip to content

Instantly share code, notes, and snippets.

View DevinWalker's full-sized avatar
🌱
Coding for good

Devin Walker DevinWalker

🌱
Coding for good
View GitHub Profile
@DevinWalker
DevinWalker / layerslider-conditional.php
Created November 21, 2013 19:12
Load LayerSlider scripts/styles only when a shortcode is present in the content (can be modified to custom meta, etc).
<?php
/**
* Load LayerSlider Scripts only when shortcode is present
*
* Deregister Scripts from LayerSlider if no shortcode in content
* Using do_shortcode function? See: http://wordpress.stackexchange.com/questions/20854/conditionally-loading-javascript-css-for-shortcodes/75915#75915
*/
function check_for_layerslider_shortcode() {
global $post;
@DevinWalker
DevinWalker / theme-tour.php
Last active March 27, 2018 17:57
Theme activation welcome message
<?php
/**
* Theme Activation Tour
*
* This class handles the pointers used in the introduction tour.
* @package Popup Demo
*
*/
class WordImpress_Theme_Tour {
@DevinWalker
DevinWalker / woocommerce-optimize-scripts.php
Last active January 8, 2024 13:24
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@DevinWalker
DevinWalker / 0_reuse_code.js
Created December 23, 2013 07:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
/**
* start the customisation
*/
function custom_woo_before_shop_link() {
add_filter('woocommerce_loop_add_to_cart_link', 'custom_woo_loop_add_to_cart_link', 10, 3);
add_action('woocommerce_after_shop_loop', 'custom_woo_after_shop_loop');
}
add_action('woocommerce_before_shop_loop', 'custom_woo_before_shop_link');
@DevinWalker
DevinWalker / Gravity-Form-Base-Styles.css
Last active February 25, 2018 14:50
Styles to help frontend development of Gravity Forms with the plugin's CSS turned off.
/* ==========================================================================
Gravity Forms
========================================================================== */
ul.gform_fields {
padding: 0;
margin: 0;
}
.gform_fields, .content .gform_fields {
@DevinWalker
DevinWalker / base-typography.css
Created May 13, 2014 18:28
Nice set of base styles for WordPress Blank themes and Roots theme
/*-----------------------------------------
Typography
--------------------------------------------*/
img.alignleft, img.alignright, img.alignnone {
border-radius: 0;
border: none;
}
@DevinWalker
DevinWalker / remove-rev-slider-metabox.php
Created May 14, 2014 20:32
This code removed the Revolution Slider metabox on pages, posts and CTPs
/**
* Remove Rev Slider Metabox
*/
if ( is_admin() ) {
function remove_revolution_slider_meta_boxes() {
remove_meta_box( 'mymetabox_revslider_0', 'page', 'normal' );
remove_meta_box( 'mymetabox_revslider_0', 'post', 'normal' );
remove_meta_box( 'mymetabox_revslider_0', 'YOUR_CUSTOM_POST_TYPE', 'normal' );
}
@DevinWalker
DevinWalker / content-product.php
Last active September 19, 2021 23:09
Correct WooCommerce hooks for Total theme template override: woocommerce/content-product.php
<?php
/**
* The template for displaying product content within loops.
*
* Override this template by copying it to yourtheme/woocommerce/content-product.php
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
@DevinWalker
DevinWalker / gist:6fb2783c05b46a2ba251
Created April 17, 2015 17:31
WordPress: Loop through Categories and Display Posts Within
<?php
/*
* Loop through Categories and Display Posts within
*/
$post_type = 'features';
// Get all the taxonomies for this post type
$taxonomies = get_object_taxonomies( array( 'post_type' => $post_type ) );
foreach( $taxonomies as $taxonomy ) :