Skip to content

Instantly share code, notes, and snippets.

View joelworsham's full-sized avatar

Joel Worsham joelworsham

View GitHub Profile
@joelworsham
joelworsham / dynamic-scripts.php
Last active August 29, 2015 14:07
Used to easily and dynamically add scripts and styles into a WordPress application.
<?php
/**
* These are all of the files (both javascript and css) that needed to be registered and enqueued.
*
* In order to use this system, create an array similar to this example and create a new "DynamicScripts" class, passing
* that array into it (like done below). Your files should use the naming convention of "{filename}.css|js" for development
* files and "{filename}.min.css|js" for the minified production files (though feel free to modify the class below
* to suit your file naming convention needs).
*
@joelworsham
joelworsham / how-to-dynamically-hide-a-widget.php
Last active August 29, 2015 14:07
How to dynamically hide a widget.Jaxon WP Meetup rules
<?php
// Don't change anything on this line EXCEPT for "hide_widget_pages". You can change that if you want, but you don't
// have to. But if you do, be sure to change it...
add_filter( 'widget_display_callback', 'hide_widget_pages', 10, 3 );
// ... here as well! And don't worry about changing anything else in this line.
function hide_widget_pages( $instance, $widget, $args ) {
// This is where you would enter the widget ID that you want to hide. Get this by using the Chrome inspector
<?php
/*
Plugin Name: test
*/
function test_filter( $test ) {
$current_day = intval( date( 'j' ) );
$change = false;
$new_array = array();