Skip to content

Instantly share code, notes, and snippets.

Avatar
💻

Tom McFarlin tommcfarlin

💻
View GitHub Profile
@tommcfarlin
tommcfarlin / functions.php
Created Aug 27, 2012
A simple example of how to add a basic sidebar to a WordPress theme
View functions.php
/**
* 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 Jun 20, 2012
Removing JavaScript tags from WordPress Widget input fields
View remove-javascript-from-wordpress-widget.php
/**
* 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 ) {