This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function() { | |
jQuery('form#contactForm').submit(function() { | |
jQuery('form#contactForm .error').remove(); | |
var hasError = false; | |
jQuery('.requiredField').each(function() { | |
if(jQuery.trim(jQuery(this).val()) == '') { | |
//var labelText = jQuery(this).prev('label').text(); | |
jQuery(this).parent().append('<span class="error text-error">← Required field</span>'); | |
hasError = true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'widgets_init', 'example_load_widgets' ); | |
/** | |
* Register our widget. | |
* 'Example_Widget' is the widget class used below. | |
* | |
* @since 0.1 | |
*/ | |
function example_load_widgets() { | |
register_widget( 'Example_Widget' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//social share | |
function social_share_it(){ | |
//get the user entered URLS/usernames from WP backend | |
$twitter = mytheme_option('twitter'); | |
$facebook = mytheme_option('facebook'); | |
$googleplus = mytheme_option('googleplus'); | |
?> | |
<?php //print he icons ?> | |
<ul id="social-share"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Custom taxonomy | |
function build_taxonomies() { | |
// create a new taxonomy | |
register_taxonomy( | |
'Tax_name', | |
'For_post_ype', | |
array( | |
'label' => __( 'Tax_label' ), | |
'sort' => true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Register Custom Post Type | |
add_action('init', 'codex_custom_init'); | |
function codex_custom_init() | |
{ | |
$labels = array( | |
'name' => _x('Rides', 'Ride'), | |
'singular_name' => _x('Rides', 'Ride'), | |
'add_new' => _x('Add New', 'Ride'), | |
'add_new_item' => __('Add New Ride'), | |
'edit_item' => __('Edit Ride'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//meta box | |
$prefix = 'sic_'; | |
$meta_box = array( | |
'id' => 'my-meta-box', | |
'title' => 'Ride Stats!', | |
'page' => 'rides', | |
'context' => 'normal', | |
'priority' => 'high', | |
'fields' => array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Example_Widget extends WP_Widget { | |
/** | |
* Widget setup. | |
*/ | |
function Example_Widget() { | |
/* Widget settings. */ | |
$widget_ops = array( 'classname' => 'sidebar-menu', 'description' => __('Displays a menu in the side bar of "Review Us", "Welcome Packet" and "Patient Forms".', 'example') ); | |
/* Widget control settings. */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mysql_prep( $value ) { | |
$magic_quotes_active = get_magic_quotes_gpc(); | |
$new_enough_php = function_exists( "mysql_real_escape_string" ); // i.e. PHP >= v4.3.0 | |
if( $new_enough_php ) { // PHP v4.3.0 or higher | |
// undo any magic quote effects so mysql_real_escape_string can do the work | |
if( $magic_quotes_active ) { $value = stripslashes( $value ); } | |
$value = mysql_real_escape_string( $value ); | |
} else { // before PHP v4.3.0 | |
// if magic quotes aren't already on then add slashes manually | |
if( !$magic_quotes_active ) { $value = addslashes( $value ); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sanitize($input) { | |
if (is_array($input)) { | |
foreach($input as $var=>$val) { | |
$output[$var] = sanitize($val); | |
} | |
} | |
else { | |
if (get_magic_quotes_gpc()) { | |
$input = stripcslashes($input); | |
} |