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 | |
// Modify the data returned for BB post module auto suggest queries to include post URLs | |
add_filter('fl_builder_auto_suggest_posts_lookup', function ( $data ) { | |
foreach ( $data as $key => $post ) { | |
$post_object = get_post( $post['value'] ); | |
// If the post object exists, append the URL path to the title | |
if ( $post_object ) { | |
$permalink = get_permalink( $post['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
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** |
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
:root { | |
--ff-heading: 'Playfair Display', serif; | |
--ff-text: 'Source Sans Pro', sans-serif; | |
--fs-h1: clamp(40px, 6.0vw + 10px, 85px); | |
--fs-h2: clamp(30px, 1.7vw + 23px, 45px); | |
--fs-h3: clamp(25px, 1.3vw + 18px, 35px); | |
--fs-h4: clamp(20px, 1vw + 15px, 28px); | |
--fs-h5: clamp(16px, 0.9vw + 12px, 22px); |
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 | |
add_filter('fluentform/rendering_field_data_input_checkbox', function ($data, $form) { | |
if ($form->id != 1) { // Form ID | |
return $data; | |
} | |
// Set which field to do this on | |
if (\FluentForm\Framework\Helpers\ArrayHelper::get($data, 'attributes.name') != 'products') { // Field name | |
return $data; |
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
// Event on form submission success | |
// You can paste this script to Form's custom JS Box | |
$form.on('fluentform_submission_success', function() { | |
document.cookie = 'cookieName=1; max-age='+90*24*60*60+'; path=/'; // Set cookie on form submission | |
}); |
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 | |
add_filter('body_class', function ($classes) { | |
if (is_singular('fl-theme-layout')) { | |
$current_post_id = get_the_ID(); | |
$layout_type = get_post_meta($current_post_id, '_fl_theme_layout_type', true); | |
$location_settings = get_post_meta($current_post_id, '_fl_theme_builder_locations', true); | |
// Proceed only if the layout type is 'singular' | |
if ($layout_type === 'singular' && !empty($location_settings) && is_array($location_settings)) { |
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
/*Turn Testimonials Module into Generic Slider*/ | |
.fl-builder-pp-testimonials-settings h1, | |
.fl-builder-pp-testimonials-settings .fl-builder-settings-tabs a:nth-child(2), | |
.fl-builder-pp-testimonials-settings .fl-builder-settings-tabs a:nth-child(3), | |
.fl-builder-pp-testimonials-settings #fl-builder-settings-section-heading_fonts, | |
.fl-builder-pp-testimonials-settings #fl-builder-settings-section-subtitle_fonts{ | |
display: none; | |
} | |
.slider-module.fl-builder-pp-testimonials-settings h1{ | |
display: block; |
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 | |
add_filter('acf/load_field/key=YOUR_FIELD_KEY_HERE', function ($field) { | |
if (get_post_type() == 'post') { | |
$field['default_value'] = 'YOUR_DEFAULT_VALUE_HERE'; | |
} | |
return $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
/* Improved Dragging BB Nodes */ | |
.fl-lightbox{ | |
transition: all .2s ease-in-out; | |
} | |
.fl-builder-dragging .fl-lightbox{ | |
opacity: .25; | |
} | |
.fl-builder-block-drag-helper.ui-sortable-helper { | |
margin-top: 40px; | |
margin-left: 20px; |
NewerOlder