Skip to content

Instantly share code, notes, and snippets.

View BronsonQuick's full-sized avatar

Bronson Quick BronsonQuick

View GitHub Profile
@BronsonQuick
BronsonQuick / different_coloured_numbers_in_ordered_lists.scss
Last active August 19, 2024 02:33
CSS to give a different color to the numbers in unordered lists
ol {
counter-reset: li; /* Initiate a counter */
margin-left: 0; /* Remove the default left margin */
padding-left: 0; /* Remove the default left padding */
}
ol > li {
position: relative; /* Create a positioning context */
margin: 0 0 0 2em; /* Give each list item a left margin to make room for the numbers */
padding: 0; /* Add some spacing around the content */
list-style: none; /* Disable the normal item numbering */
@BronsonQuick
BronsonQuick / saas_gravity_forms.scss
Last active December 15, 2015 22:39
A Saas file I use for generating custom Gravity Forms styles for clients sites.
/*!
----------------------------------------------------------------
Gravity Forms Front End Form Styles
Version 1.0
http: //www.gravityforms.com
Based on the original forms.css that ships with Gravity Forms
----------------------------------------------------------------
*/
@BronsonQuick
BronsonQuick / gravity_form_elements.xml
Created April 8, 2013 05:04
If you're using your own Gravity Forms CSS styling then import this xml file into your WordPress site to see if you've styled all of the Gravity Form fields and labels correctly.
<?xml version="1.0" encoding="UTF-8"?>
<forms version="1.6.12">
<form labelPlacement="top_label" useCurrentUserAsAuthor="1">
<title><![CDATA[GF Form 1 Test - Top aligned labels, Descriptions below inputs]]></title>
<description><![CDATA[We would love to hear from you! Please fill out this form and we will get in touch with you shortly.]]></description>
<confirmation type="message">
<message><![CDATA[Thanks for contacting us! We will get in touch with you shortly.]]></message>
</confirmation>
<button type="text">
<text><![CDATA[Submit]]></text>
@BronsonQuick
BronsonQuick / highest_wordpress_image_quality.php
Created February 7, 2013 04:56
Make the WordPress Image Quality to be 100% quality
<?php
/**
* Filters the image quality for thumbnails to be at the highest ratio possible.
*
* Supports the new 'wp_editor_set_quality' filter added in WP 3.5.
*
* @since 1.0.0
*
* @param int $quality The default quality (90)
* @return int $quality Amended quality (100)
@BronsonQuick
BronsonQuick / add_parent_class_to_wordpress_menu.php
Created January 30, 2013 15:47
Add a 'parent' CSS class to WordPress wp_nav_menus
<?php
/* Add a function to add a parent class to WordPress parent menus */
function sennza_add_menu_parent_class( $items ) {
$parents = array();
foreach ( $items as $item ) {
if ( $item->menu_item_parent && $item->menu_item_parent > 0 ) {
$parents[] = $item->menu_item_parent;
}
}
@BronsonQuick
BronsonQuick / gist:4592403
Created January 22, 2013 05:43
Force mp3's to download
#Add this to .htaccess
<FilesMatch "\.(?i:mp3)$">
ForceType audio/mpeg
SetEnvIf Request_URI "^.*/?([^/]*)$" FILENAME=$1
Header set Content-Disposition "attachment; filename=%{FILENAME}e"
UnsetEnv FILENAME
</FilesMatch>
@BronsonQuick
BronsonQuick / gist:4535974
Created January 15, 2013 04:13
Remove extra 10px that WordPress adds to captions props to Justin Tadlock: http://justintadlock.com/archives/2011/07/01/captions-in-wordpress
<?php
/**
* This function removes the extra 10px width that WordPress adds to captions
*
* @param $output
* @param $attr
* @param $content
*
* @return string
*/
@BronsonQuick
BronsonQuick / gist:3774261
Created September 24, 2012 05:05
Changes wp_link_pages to be an unordered list in WordPress
<?php /*
* Function similar to wp_link_pages but outputs an ordered list instead and adds a class of current to the current page
*/
function pico_link_pages( $args = '' ) {
$defaults = array(
'before' => '<p>' . __( 'Pages:' ), 'after' => '</p>',
'link_before' => '', 'link_after' => '',
'next_or_number' => 'number', 'nextpagelink' => __( 'Next page' ),
'previouspagelink' => __( 'Previous page' ), 'pagelink' => '%',
@BronsonQuick
BronsonQuick / add_custom_xml_tags_to_tinymce_wordpress.php
Created September 4, 2012 01:43
Add custom tags to TinyMCE in WordPress
<?php
/*
* Our client needed some data sent in XML tags from Gravity Forms notifications to their system. These tags were being stripped by
* TinyMCE when the client would switch from HTML to Visual. This was my fix for it.
*
*/
function sennza_add_custom_tinymce_tags( $init ) {
// Command separated string of extended elements
$ext = 'name[*],phone[*],src[*],ip[*],notes[*],email[*]';
@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;