Skip to content

Instantly share code, notes, and snippets.

View offroadkev's full-sized avatar
😎

Kev offroadkev

😎
  • Las Vegas, Nevada
View GitHub Profile
@offroadkev
offroadkev / vk-modal.css
Created August 17, 2018 20:10
Simple, Minimalist Modal Box w/Slide-In Effect
.vk-modal--overlay {
display: block;
z-index: -1;
position: fixed;
top: 100%;
left: 0;
width: 100vw;
height: 100vh;
/* background-color: rgba(252, 124, 86, 0.7); */
background-color: rgba(17, 158, 230, 0.7);
@offroadkev
offroadkev / functions.php
Created July 20, 2018 22:05
Change Gravity Forms Spinner to CSS Spinner
// Changes Gravity Forms Ajax Spinner (next, back, submit) to a transparent image
// this allows you to target the css and create a pure css spinner like the one used below in the style.css file of this gist.
add_filter( 'gform_ajax_spinner_url', 'spinner_url', 10, 2 );
function spinner_url( $image_src, $form ) {
return 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; // relative to you theme images folder
}
@offroadkev
offroadkev / functions.php
Last active June 14, 2016 06:51
Hide Native WordPress Thumbnail Meta Box
<?php
/*
* Hide Native WP Thumbnail Meta Boxes by Page ID
* Note: I really should switch this to check page template, not page ID
*/
function hide_native_thumbnail_meta_box() {
// Store our page ID's
$excluded_page_ids_array = array(6,91,225,84);
// Get Post ID
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
@offroadkev
offroadkev / functions.php
Last active June 14, 2016 06:51
Hide WP Editor For Specific Page Edit Screens
<?php
/*
* Hide WP Editor for Specific Page IDs
* Note: I really should update this to be by page template
*/
function hide_native_wysiwyg_editor() {
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID']; // Get post ID
if( !isset( $post_id ) ) return;
if( $post_id == '17' || $post_id == '33') { // add page ID's
remove_post_type_support('page', 'editor');
@offroadkev
offroadkev / test_wp_mail.php
Created February 25, 2016 20:27 — forked from butlerblog/test_wp_mail.php
File for testing the wp_mail function http://b.utler.co/9L
<?php
/**
* This file can be used to validate that the WordPress wp_mail() function is working.
* To use, change the email address in $to below, save, and upload to your WP root.
* Then browse to the file in your browser.
*
* For full discussion and instructions, see the associated post here:
* http://b.utler.co/9L
*
* Author: Chad Butler
@offroadkev
offroadkev / jquery.smoothanchors.js
Created October 1, 2015 20:24
Smooth anchor transitions
var $ = jQuery.noConflict();
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
@offroadkev
offroadkev / functions.php
Last active October 1, 2015 19:16
WordPress Meta Box with a wp_editor field
<?php
// Some quick notes about this code:
// Keep in mind this is for a 'portfolio' post type.
// Also, you'll notice the meta key sometimes has a leading underscore. This is so the meta field and saved data don't appear in the native 'custom fields' fields, just in case you have them supported in your post type args
// While it says this should go in functions.php, it should really go in your post type plugin file. In this case it would be the portfolio.php file
// Services Provided meta box & wp_editor field
function services_provided_meta_box(){
add_meta_box("services-provided-meta-fields", "Services Provided", "services_provided_meta", 'portfolio', "normal", "low");
}
@offroadkev
offroadkev / styles.css
Created September 23, 2015 06:55
Quick Dropcaps on First Letter of First Paragaph of WordPress Post
/*
*
* Add Dropcaps to blog articles
*
*/
.entry-content p:first-child:first-letter { /* Replace .entry-content class with whatever class you use for blog content p tags */
font-size: 120px;
font-family: ProximaNovaBold;
padding: 0px;
line-height: 52px;
@offroadkev
offroadkev / functions.php
Created September 23, 2015 06:43
Quick Featured Post Checkbox For WordPress Blog Posts (native 'posts' post type
/*
* Adds a Featured Post meta box to the post editing screen
*/
function blog_featured_meta() {
add_meta_box( 'blog_meta', __( 'Featured Posts', 'blog-textdomain' ), 'blog_meta_callback', 'post', 'side', 'high' );
}
add_action( 'add_meta_boxes', 'blog_featured_meta' );
/**
* Outputs the content of the meta box
@offroadkev
offroadkev / functions.php
Created September 23, 2015 06:40
WordPress Comment Form Placeholders
/*
*
* Add Placeholders to Comment Forms
* Keep in mind that if you want to kill the labels, the easiest way is use display:none in your stylesheet for the labels
*
*/
add_filter( 'comment_form_default_fields', 'sabretooth_comment_placeholders' );
function sabretooth_comment_placeholders( $fields ) {
$fields['author'] = str_replace(