Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
tommcfarlin / functions.php
Created August 27, 2012 13:09
A simple example of how to add a basic sidebar to a WordPress theme
/**
* Registers a new sidebar with the theme.
*
* Note: replace 'themename' with the name of your theme.
*/
function themename_add_sidebar() {
/*
* Description of the parameter array is as follows:
*
@tommcfarlin
tommcfarlin / remove-javascript-from-wordpress-widget.php
Created June 20, 2012 12:58
Removing JavaScript tags from WordPress Widget input fields
/**
* This function is part of the WordPress Widget API.
*
* It's fired when the widget is being updated and using the incoming
* $new_instance to update the values stored in the incoming $old_instance.
*
* We're allowing users to store CSS and HTML in their input field but we're
* stripping out JavaScript tags.
*/
public function update( $new_instance, $old_instance ) {