- Add Field to Body Class
- Custom Excerpt Field
- Default Image
- Google Address Shortcode
- Google Map Multiple Marker Shortcode
- Numbers with commas
- Repeater + Bootstrap Modal + Modal Nav
- Repeater with button for Show-Hide
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
// Hide all expanded steps | |
$('.expandedstep').hide() | |
//Show expanded steps while in the builder | |
$('html.fl-builder-edit .expandedstep').show(); | |
// When an expand step button is clicked | |
$('.expandstepbtn').on('click', function(e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ACF Google Map Field -> Address Shortcode | |
add_shortcode( 'acf_address' , function( $atts ) { | |
if (!function_exists('get_field') ) return ''; | |
$atts = shortcode_atts( array( 'field' => false , 'sub' => 'address' ) , $atts, $shortcode = 'acf_address' ); | |
if ($atts[ 'field' ] && $map = get_field( $atts[ 'field'] ) ) { | |
if ( isset( $map[ $atts['sub'] ] ) ) return $map[ $atts['sub'] ]; | |
} | |
return '[ something went wrong ]'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Return ACF Number Fields Formatted with Commas on the Frontend | |
add_filter('acf/format_value/name=ACF_FIELD_NAME', 'acf_number_comma', 20, 3); | |
add_filter('acf/format_value/name=ANOTHER_ACF_FIELD_NAME', 'acf_number_comma_decimal', 20, 3); | |
// Without Decimal | |
function acf_number_comma($value, $post_id, $field) { | |
$value = number_format(floatval($value)); | |
return $value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
let $vimeoPlayer = $('#hero-row .fl-bg-video').data('VMPlayer'); | |
$vimeoPlayer.setLoop(false); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Makes a BB Column clickable. | |
* Pre-requisite: There must be an A Tag contained within the column element and a class of clickable-col for the column | |
*/ | |
jQuery(document).ready(function($) { | |
// Exit if BB layout is in edit mode. | |
if (typeof window.FLBuilderConfig !== 'undefined') { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// example custom post type is "event" | |
// example custom taxonomy is "events-category" | |
function remove_default_event_category_metabox() { | |
remove_meta_box( 'tagsdiv-events-category', 'event', 'side' ); | |
} | |
add_action( 'admin_menu' , 'remove_default_event_category_metabox' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* JS for scrolled header: */ | |
const header_a = document.querySelector('#header-row-a'); | |
const header_b = document.querySelector('#header-row-b'); | |
var posY = 0; | |
window.addEventListener('scroll', function(e) { | |
//how far down you scroll | |
if (this.pageYOffset > 855) { | |
if (this.pageYOffset > posY) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
$.fn.equalHeights = function() { | |
let max_height = 0; | |
$(this).each(function() { | |
max_height = Math.max($(this).height(), max_height); | |
}); | |
$(this).each(function() { | |
$(this).height(max_height); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a collection of my most used or most useful PHP and JS snippets | |
**Disclaimer, I didn't write most of these - I just curated them over the years** |
OlderNewer