Skip to content

Instantly share code, notes, and snippets.

View bdeleasa's full-sized avatar

Brianna Deleasa bdeleasa

View GitHub Profile
@bdeleasa
bdeleasa / woocommerce-hide-usps-fallback-rate
Last active August 29, 2015 14:16
Initially hide the USPS fallback rate if the user didn't enter a state or postal code.
/**
* Returns either true or false depending on whether the user has entered
* a shipping state or postal code.
*
* @param none
*
* @return bool
*/
function initially_hide_usps_fallback_rate() {
@bdeleasa
bdeleasa / wp-print-enqueued-scripts-styles
Last active August 29, 2015 14:21
Functions to print all enqueued scripts and styles.
<?php
// add_action( 'wp_print_scripts', 'rroots_print_enqueued_styles' );
/**
* Function for printing all enqueued styles. This is useful if you want to dequeue styles enqueued by plugins.
*
* @usage Uncomment the add_action following this function
* @params none
*/
function rroots_print_enqueued_styles() {
@bdeleasa
bdeleasa / ngg-script-optimizer
Created July 2, 2015 14:58
Stops the Nextgen Gallery scripts from being loaded on pages without a gallery
<?php
/**
*
* @wordpress-plugin
* Plugin Name: NextGen Gallery Script Optimizer
* Plugin URI: http://chooserethink.com
* Description: Removes NextGen Gallery scripts on pages that don't have a gallery on it.
* Version: 1.0.0
* Author: Brianna Deleasa @ re:think
* Author URI: http://chooserethink.com
@bdeleasa
bdeleasa / dequeue-sci-scripts
Created July 7, 2015 15:23
Dequeue's the Simple Contact Info plugin styles.
add_action( 'wp_enqueue_scripts', 'themename_dequeue_sci_scripts', 999 );
/**
* Remove the Simple Contact Info styles from our theme
*
* @param none
* @return none
*/
function yorksonlegal_dequeue_sci_scripts() {
wp_dequeue_style( 'contact-info' );
@bdeleasa
bdeleasa / gist:7668d33225441b325070
Created July 7, 2015 15:31
Dequeue's the WP Social Networks Widget plugin styles
<?php
add_action( 'wp_enqueue_scripts', 'themename_dequeue_wpsnw_styles', 9999 );
/**
* Removes the WP Social Networks Widget plugin styles because we're styling
* the icons with our theme CSS.
*
* @param none
* @return none
*
@bdeleasa
bdeleasa / wp-rename-set-featured-image
Created July 9, 2015 16:01
A Wordpress plugin that renames the Featured Image metabox and text.
@bdeleasa
bdeleasa / does-url-exist
Created July 20, 2015 13:50
Function that checks whether the given URL exists (not a 404 page).
<?php
/**
* Figures out whether the given URL exists
*
* @param string
* @return bool
*
* @since 0.0.1
*/
function does_url_exist( $url ) {
@bdeleasa
bdeleasa / ngg-customizations.php
Last active August 29, 2015 14:25
Removes all default scripts and styles outputted by the Nextgen Gallery plugin. It also outputs the necessary code to replace the lightbox with the Foundation 5 reveal modal.
<?php
new Nextgen_Gallery_Customizations();
/**
* Class Nextgen_Gallery_Customizations
*
* The class responsible for removing all of the default scripts and
* styles that Nextgen outputs and replacing the scripts with the
* necessary jQuery to activate the Foundation 5 Reveal modal. This
@bdeleasa
bdeleasa / testimonials-by-woothemes-menu-fix.php
Created August 25, 2015 14:21
Fixes the issue of the Blog menu item and the testimonials archive menu item being 'active' at the same time when using the Testimonials by Woothemes plugin.
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
* @link http://example.com
@bdeleasa
bdeleasa / get-widgets-count.php
Created August 26, 2015 14:31
Function for Wordpress that returns the number of active widgets in a sidebar.
<?php
/**
* Counts the number of widgets in a widget area.
*
* @param $sidebar_index string The id of the widget area
* @return int
*/
function get_widgets_count( $sidebar_index ) {
global $wp_registered_sidebars;