Skip to content

Instantly share code, notes, and snippets.

@jbd91
jbd91 / snippet.php
Created February 2, 2018 04:16
ACF Metabox Order Fix
// ACF Metabox order fix
function topfloor_reset_metabox_positions(){
delete_user_meta( 1, 'meta-box-order_post' );
delete_user_meta( 1, 'meta-box-order_page' );
delete_user_meta( 1, 'meta-box-order_custom_post_type' );
}
add_action( 'admin_init', 'topfloor_reset_metabox_positions' );
@jbd91
jbd91 / snippet.php
Created February 2, 2018 04:18
Custom Shortcode for File Upload Info ( Detects File Type and Size )
//Custom shortcode to add file info to Toolset Views
add_shortcode('file-info', 'file_info_shortcode');
function file_info_shortcode() {
$attachment_id = get_field('file_upload');
$filesize = filesize( get_attached_file( $attachment_id ) );
$filesize = size_format($filesize, 2);
$path_info = pathinfo( get_attached_file( $attachment_id ) );
@jbd91
jbd91 / snippet.php
Created February 2, 2018 04:20
Custom Gravity Forms Button
add_filter("gform_submit_button_1", "form_submit_button1", 10, 2);
function form_submit_button1($button, $form){
return "<button class='button' id='gform_submit_button_{$form["id"]}'><span>Send Now <i class=\"fa fa-arrow-right\" aria-hidden=\"true\"></i></span></button>";
}
@jbd91
jbd91 / snippet.js
Created February 2, 2018 04:24
Back to Top Button
// Back to Top Button
var offset = 100;
var speed = 250;
var duration = 500;
$(window).scroll(function(){
if ($(this).scrollTop() < offset) {
$('.top-button') .fadeOut(duration);
} else {
@jbd91
jbd91 / snippet.js
Created February 2, 2018 04:25
Off Canvas Duplicate Nav Item Foundation Fix
// Duplicates parent nav item link on off canvas menu and places it in the submenu so link can be clicked (fix for issue with foundation off canvas toggle)
$('.off-canvas li.menu-item-has-children').each(function(){
link=($(this)[0].children[0].outerHTML);
ul=$(this).find($('ul'));
ul.children().children().first().parent().before('<li class="parentlink">'+link+'</li>');
});
@jbd91
jbd91 / snippet.js
Created February 2, 2018 04:26
Mix It Up Load More
// Mix It Up
$(function() {
if ($('body').is('.page-id-257')) {
var containerEl = document.querySelector('#resource-catalog--filter');
var loadMoreEl = document.querySelector('#load-more');
var currentLimit = 4;
var incrementAmount = 4;
var mixer = mixitup(containerEl, {
@jbd91
jbd91 / snippet.php
Created February 2, 2018 04:28
Geo Location IP Address: Detect Latitude/Longitude and Convert to Area Code
<?php
$numbers = [
414 => '414-438-8420',
920 => '920-731-2640',
715 => '715-835-3052',
608 => '608-825-1000',
847 => '847-466-0465',
952 => '952-260-3769',
319 => '319-231-0696',
];
@jbd91
jbd91 / snippet.scss
Created February 2, 2018 21:31
Text Separator LI
li + li:before {
content: " | ";
}
@jbd91
jbd91 / snippet.php
Last active February 23, 2018 16:44
Featured Image Banner
<?php $banner_img = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full') ?>
<?php if ($banner_img) : ?>
<div class="banner" style="background-image: url(<?php echo $banner_img[0]; ?>);">
</div>
<?php endif; ?>
@jbd91
jbd91 / snippet.php
Created February 2, 2018 21:44
WP Query Arguments
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(