Skip to content

Instantly share code, notes, and snippets.

Shane Jones shanejones

Block or report user

Report or block shanejones

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@shanejones
shanejones / .htaccess
Created May 5, 2017
301 all HTTP to HTTPS
View .htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
View throttling function
function throttle(f, delay){
var timer = null;
return function(){
var context = this, args = arguments;
clearTimeout(timer);
timer = window.setTimeout(function(){
f.apply(context, args);
},
delay || 500);
};
View peadig-bootstrap-components.php
<?php
/**
* Bootstrap Alert Dialog
*
* @link http://v4-alpha.getbootstrap.com/components/alerts/
*
* @param $a array containing the options for this function. Expected array keys are below
* html - string - this is the HTML that will be outputted
* type - string - type of alert info(default), success, warning, danger
* close_button - bool- true or false to display
View simple related posts plugin
View page-user-family-details.php
<?php echo $adults ?> live in a <?php echo ($bedrooms==1?$bedrooms . ' bedroom': $bedrooms . ' bedrooms') ?> <?php echo $home_type ?> in <?php echo $town ?>.
<?php if($children!=0): ?>
They live with <?php echo $children ?> children in the home.
Their
<?php if($child_1_gender != 'N/a' && $child_1_gender != 'None'): ?>
<?php echo $child_1_gender ?> was born in <?php echo $child_1_dob ?>
<?php endif; ?>
<?php if($child_2_gender != 'N/a' && $child_2_gender != 'None'): ?>
View Location Search
@shanejones
shanejones / und2_form_resubmit_fields.php
Last active Dec 21, 2018
If you're submitting a form using GForms and populating ACF you'll need ot run this script on save to push the fields into ACF correctly
View und2_form_resubmit_fields.php
/**
* Save Form Items to ACF Properly
*
*
*/
function und2_form_resubmit_fields($entry, $form){
$args = array(
'post_type' =>'CUSTOM_POST_TYPE',
'posts_per_page' => 1
);
View WP_Check_Image_Size.php
/**
* Function to check weather or not an image sizes exists in the thumbnail library for a specific attachment id
*
* @param $attachment_id - the id of any image in the se
* @param $image_size_name - the name from add_image_size()
*
* @return bool
*/
function check_image_size( $attachment_id, $image_size_name ){
@shanejones
shanejones / lazy-link.js
Created Mar 22, 2019
For lazy loading favicons
View lazy-link.js
@shanejones
shanejones / und2-social-sharing.php
Last active Jun 26, 2019
Replaces any bloated social plugins with a simpler version. Replace images with SVG or anything else.
View und2-social-sharing.php
<?php
/**
* Replaces the old social sharing shortcode with a lightweight, no dependecy version
*
* @return void
*/
function under2_social_buttons(){
$id = get_the_ID();
You can’t perform that action at this time.