- Download this whole Gist as a zip and extract
- Import the Hero Field Group (acf-hero-fields.json) into ACF (/wp-admin/edit.php?post_type=acf-field-group&page=acf-tools) - I like to exclude my Homepage for this fieldgroup as my homepage always has a custom hero section
- Paste the function for adding the body class (hero-bg-body-class.php) into your functions.php file or snippet plugin, leaving out the <?php at the beginning of the file
- Paste the hero styles CSS (hero-styles.css) into wherever you are writing your CSS (styles.css, customizer, BB Global CSS, etc)
- Use Wordpress importer (/wp-admin/import.php) to import the Themer Part (hero-themer-part.xml). Same as the ACF field group, I like to exclude my Homepage from this Themer Part as it always gets a custom hero
- Open the Themer Part with BB and edit the Row settings. For the Background Photo section, click on the wrench to set
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 // ignore - for formatting only | |
// Useful if you are creating custom taxonomines and controlling them with ACF. This will remove all the metaboxes for your custom taxonomies | |
function edit_taxonomy_args( $args, $tax_slug, $cptui_tax_args ) { | |
// Set to false for all taxonomies created with CPTUI. | |
$args['meta_box_cb'] = false; | |
return $args; | |
} | |
add_filter( 'cptui_pre_register_taxonomy', 'edit_taxonomy_args', 10, 3 ); |
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 //ignore this line - for formatting only | |
// add default image setting to acf image field | |
add_action('acf/render_field_settings/type=image', 'add_default_value_to_image_field'); | |
function add_default_value_to_image_field($field) { | |
acf_render_field_setting( $field, array( | |
'label' => 'Default Image', | |
'instructions' => 'Appears when creating a new post', | |
'type' => 'image', | |
'name' => 'default_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
<?php //ignore - only for formatting | |
//Show Only Current and Future Events | |
function event_CPT_date_filter( $query_args ) { | |
if ( 'date-grid' == $query_args['settings']->id ) { //id of your module - example here is date-grid | |
$today = current_time('Ymd'); | |
$type = 'events'; //CPT slug | |
$eventdate = 'event_end_date'; //ACF date picker field |
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 //for formatting - ignore this line | |
// Move Old Events to 'Past Event' Taxonomy | |
add_action( 'hide_old_events', 'run_hide_old_events' ); | |
add_action('admin_init', function() { // check on admin load, could be on init, but seems overkill | |
if (! wp_next_scheduled ( 'hide_old_events' )) { //see if the event is set | |
wp_schedule_event( strtotime('tomorrow 12:01am'), 'daily', 'hide_old_events' ); //Schedule it to run at 12:01 am - adjust to your liking | |
} |
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 // ignore - for formatting purposes | |
function themer_with_front( $args ) { | |
$args['rewrite']['with_front'] = false; | |
return $args; | |
} | |
add_filter( 'fl_theme_builder_layout_register_post_type_args', 'themer_with_front', 20, 1 ); | |
function bb_with_front( $args ) { |
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
<?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
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
<?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 ]'; |