Skip to content

Instantly share code, notes, and snippets.

View theJasonJones's full-sized avatar

Jason Jones theJasonJones

  • Edward Jones
  • St. Louis, MO
View GitHub Profile
@theJasonJones
theJasonJones / gravity-form-reset.less
Last active March 8, 2017 21:57
Base Gravity Form Resets
@light-blue : #02a0df;
@black : #000;
.button( @color: @light-blue ) { .btn; border-radius: 0px; background-color: @color; color: #FFF; font-size: 16px; font-weight: bold; line-height: 28px; letter-spacing: .02em; text-transform: uppercase; padding: 6px 61px; .transition(background-color .4s ease);
&:hover, &:active, &:focus { background-color: darken(@light-blue, 10%); color: white; }
}
/*
* Labels and input on the same line with inline checkboxes and radios
@theJasonJones
theJasonJones / loop.php
Last active September 10, 2019 19:12
WP Auto-submit select using wp_dropdown_categories. These usually go in the same file but i separated them for (my) clarity.
<?php
$category_id = htmlspecialchars($_GET['cat']);
if( !empty($category_id) ){
$args = array(
'posts_per_page' => -1,
'post_type' => 'testimonials',
'orderby' => 'menu_order',
'order' => 'ASC',
'post_status' => 'publish',
'tax_query' => array(
@theJasonJones
theJasonJones / README.md
Last active March 1, 2017 16:02
Bootstrap pagination

WP Pagination

Intended as a quick reference/snipppet for WP pagination.

If you get a weird 404 when paginating

  1. Go to the Reading tab.

2)Change the Blog pages show at most from the default 10 to any number *less than 10.

@theJasonJones
theJasonJones / custom-selects.less
Created August 3, 2016 16:54
Updated custom selects with Font Awesome Icons
/* Container used for styling the custom select, the buttom class below adds the
* bg gradient, corners, etc. */
.custom-select {
position: relative;
display: block;
select {
width: 100%;
margin: 0;
height: 50px;
border: 1px solid #CCC;
@theJasonJones
theJasonJones / carousel.md
Created August 30, 2016 18:58
Bootstrap Carousel Reset
@theJasonJones
theJasonJones / README.md
Last active April 14, 2017 21:09
Checkboard layout

Checkboard layout ( Fifty Fifty layout )

A.K.A. alternating image and content blocks on each row.

SASS Version is a basic 50/50 with no CTA added in.

Adding this here because I'm sick of recreating it over & over. Includes option for a CTA anywhere you want using the Flexible Layout option.

@theJasonJones
theJasonJones / README.md
Last active March 30, 2017 16:28
Alt Filler

Image Alt Attribute filler

Put this helper function your functions.php file and pass in an argument (or don't). This way you're alt attribute is always filled out for every image on your site.

This checks to see if the alt attribute is assigned in the WordPress media library and returns that or it just returns the name of the site.

Tip: Use Advanced Custom Fields for the alt attribute.

@theJasonJones
theJasonJones / README.md
Last active November 8, 2016 15:39
Placeholder Transitions

##Gravity Form "placeholder" transition.

Screenshot

Uses labels as placeholders.

  • Fields must be required.
  • Labels must be placed behind the text inputs
@theJasonJones
theJasonJones / functions.php
Last active November 11, 2016 17:17
Forces a featured image to set and displays error if one isn't set.
add_action('save_post', 'pk_require_post_thumbnail');
add_action('admin_notices', 'pk_post_thumbnail_error');
function pk_require_post_thumbnail($post_id) {
// change to any custom post type
if(get_post_type($post_id) != 'post')
return;
if ( !has_post_thumbnail( $post_id ) ) {
@theJasonJones
theJasonJones / functions.php
Last active July 2, 2025 12:40
Add async or defer to a WordPress script
//Enqueue JS like we normally do.
function add_test_js_files(){
wp_enqueue_script('script1', '//script1.js?cid=6asdfsdf');
wp_enqueue_script('script2', '//script2.js?cid=a213423423');
}
add_action('wp_enqueue_scripts','add_test_js_files');
function add_async_attribute($tag, $handle) {