Skip to content

Instantly share code, notes, and snippets.

View BronsonQuick's full-sized avatar

Bronson Quick BronsonQuick

View GitHub Profile
@BronsonQuick
BronsonQuick / add_gravity_forms_anchor.php
Created May 31, 2012 02:42
Add an anchor for Gravity Forms when forms are submitted
<?php
/* If the gravity form is below the fold the user can get confused if there isn't an anchor on the form */
add_filter("gform_confirmation_anchor", create_function("","return true;"));
?>
@BronsonQuick
BronsonQuick / CSS_pdf.css
Created June 1, 2012 03:40
CSS to add a PDF icon
blockquote a[href$='.pdf'] {
padding: 0 0 0 22px;
padding-bottom:2px;
background: transparent url(images/icon_pdf.gif) 0 0 no-repeat;
font-weight: bold;
}
@BronsonQuick
BronsonQuick / register_wordpress_taxonomy.php
Created June 1, 2012 03:51
Register WordPress Taxonomy
<?php $labels = array(
'name' => _x( 'Types', 'taxonomy general name' ),
'singular_name' => _x( 'Type', 'taxonomy singular name' ),
'search_items' => __( 'Search Types' ),
'all_items' => __( 'All Types' ),
'parent_item' => __( 'Parent Type' ),
'parent_item_colon' => __( 'Parent Type:' ),
'edit_item' => __( 'Edit Type' ),
'update_item' => __( 'Update Type' ),
'add_new_item' => __( 'Add New Type' ),
@BronsonQuick
BronsonQuick / display_data_gravity_forms_form.php
Created June 12, 2012 06:55
Display data from a Gravity Forms form
<?php
/*
Plugin Name: Brisbane Respsonsive Lab Credits
Plugin URI: http://www.sennza.com.au
Description: A plugin to display the gravatars, names and devices of the people who have donated devices to the project
Version: 1.0
Author: Bronson Quick
Author URI: http://www.sennza.com.au
License: GPL2
*/
@BronsonQuick
BronsonQuick / remove_sections_of_the_wordpress_theme_customizer.php
Created June 21, 2012 10:51
Removes sections of the WordPress 3.4 Theme Customizer
<?php
/*
* Removes some of the theme customiser elements that we aren't using in this theme
*/
add_action ( 'customize_register', 'pico_themes_remove_theme_customiser_options');
function pico_themes_remove_theme_customiser_options( $controls ){
$controls->remove_section( 'title_tagline' );
$controls->remove_section( 'colors' );
}
?>
@BronsonQuick
BronsonQuick / testimonials_custom_post_type.php
Created July 12, 2012 05:25
A Testimonials Custom Post Type in a PHP class
<?php
/*
Plugin Name: Pico Themes Testimonials
Plugin URI: http://wwww.picothemes.com/
Description: This plugin generates a custom post type for Testimonials
Author: Bronson Quick
Version: 1.0
Author URI: http://www.picothemes.com/
*/
@BronsonQuick
BronsonQuick / count_number_of_widgets_wordpress.php
Created July 19, 2012 01:46
Count the number of widgets in a sidebar in WordPress
<?php
/**
* Count the number of widgets in a sidebar
* Works for up to ten widgets
* Usage <?php ctm_sidebar_class( 'promo' ); ?> where promo is the name of the sidebar
*/
function ctm_sidebar_class( $sidebar_name ) {
global $sidebars_widgets;
$count = count ($sidebars_widgets[$sidebar_name]);
@BronsonQuick
BronsonQuick / remove_unwanted_menu_and_toolbar_items_wordpress.php
Created July 25, 2012 05:49
Remove unwanted menu items from the Menu Bar and Toolbar in WordPress
<?php
/* Remove unwanted menus in WordPress e.g. Posts, Comments and Links */
/* Inspired by http://wordpress.org/extend/plugins/white-label-cms/ */
function ctm_remove_admin_menus() {
global $menu, $submenu;
$exclude[0] = '';
array_push($exclude,__('Posts','default'));
array_push($exclude,__('Comments','default'));
array_push($exclude,__('Links','default'));
unset($exclude[0]);
@BronsonQuick
BronsonQuick / add_custom_classes_tinymce_wordpress.php
Last active August 19, 2024 02:35
Add custom classes to TinyMCE in WordPress because I hate shortcodes :)
<?php
/* Add the Style Dropdown Menu to the second row of visual editor buttons
* N.B. Make sure you include your custom classes in both your style.css AND editor-style.css :)
*/
function pico_themes_mce_buttons( $buttons ) {
array_unshift( $buttons, 'styleselect' );
return $buttons;
}
@BronsonQuick
BronsonQuick / clear_gravity_form_default_values.js
Last active August 19, 2024 02:34
Clear default values in Gravity Forms and place them back in on blur if they are empty
jQuery(document).ready(function($) {
jQuery.fn.cleardefault = function() {
return this.focus(function() {
if( this.value == this.defaultValue ) {
this.value = "";
}
}).blur(function() {
if( !this.value.length ) {
this.value = this.defaultValue;