Skip to content

Instantly share code, notes, and snippets.

@tdrayson
tdrayson / custom-function.php
Last active Sep 25, 2022
Automatically call custom functions in Generateblocks Dynamic Data
View custom-function.php
/*
* @function Automatically call custom functions in Generateblocks Dynamic Data
* @author Taylor Drayson
* @since 22/09/2022
*
* Replace $key with your unique prefix for all custom functions
*/
add_filter( 'generateblocks_dynamic_content_output', function( $content, $attributes ) {
if ( 'post-meta' === $attributes['dynamicContentType'] && isset( $attributes['metaFieldName'] ) ) {
@tdrayson
tdrayson / populate-dropdown.php
Created Aug 23, 2022
Populate ACF dropdown with Fluent forms
View populate-dropdown.php
<?php
/*
Instructions
Replace YOUR_ACF_FIELD with the name of your acf select dropdown key
Add to functions.php or code snippets plugin
Forms will load sorted by Title in ASC order (A to Z)
@tdrayson
tdrayson / fluent-form-dropzone.css
Last active Aug 20, 2021
Fluent Form Custom Dropzone Styling (File / Image Upload field)
View fluent-form-dropzone.css
/*
Add class 'dropzone' to the upload fields that you would like to have this styling
*/
.fluentform .dropzone .ff_upload_btn.ff-btn {
color: #646c7f;
padding: 3rem;
width: 100%;
border: 2px dashed #0087f7;
border-radius: 5px;
background: rgba(223, 240, 255, 0.13);
@tdrayson
tdrayson / FF-responsive-payment-summary-table
Last active Sep 18, 2021
Make the Fluent Forms Payment Summary Table Responsive for smaller devices like Mobile
View FF-responsive-payment-summary-table
/* Start of Payment Summary Table CSS */
@media only screen and (max-width: 530px) {
.fluentform .ffp_table thead{
display:none;
}
.fluentform table{
display: block;
}
@tdrayson
tdrayson / FF-image-radio-field.css
Last active Jun 27, 2022
Fluent Forms Image Radio Field CSS
View FF-image-radio-field.css
/**
* Styles the Radio field as clickable image for Fluent Forms
*
* Use: Paste into Custom CSS Section of your Form
* Add class "fancy-input" to container of all inputs that need the fancy styling
*
* Forked version of Sebastian Berger from inital post Fluent Forms FB Group - https://bit.ly/37BBpet
* FB Post - https://bit.ly/2ZEn2BG
*
* Full Links at bottom
@tdrayson
tdrayson / Conditionally_display CPT_based_on_post_object_field.php
Last active Nov 8, 2020
If you trying to query the post object field to between 2 CPT's. This condition checks if the repeater is empty or not.
View Conditionally_display CPT_based_on_post_object_field.php
// Add the function to advanced scripts (or code snippet)
// Create a condition in the builder to the section where you want to hide
// Select dynamic data -> php function -> “Check_CPT_Repeater”
// Inside the arguments section add your "cpt_name" and post object "acf_field"
// Set dynamic data == 0 (to hide if no results are returned)
function Check_CPT_Repeater( $cpt_name, $acf_field ){
//WP_Query arguments
$args = array(
View Masonry_layout_with_oxygen_layout.css
//Set the repeater to 100% width
// Set display:block
// Add the below to custom css in repeater
-webkit-column-count: 4;
-moz-column-count: 4;
column-count: 4;
// Set Div inside repeater to display:block
//Add the below to the custom css
View disable_update_notification.php
// remove update notice for forked plugins
function remove_update_notifications($value) {
if ( isset( $value ) && is_object( $value ) ) {
unset( $value->response[ plugin_basename(__FILE__) ] );
}
return $value;
}
add_filter( 'site_transient_update_plugins', 'remove_update_notifications' );
View colour_overlay_on_hover.css
/*Image Overlay on Hover*/
.image-overlay{
position: relative;
cursor: pointer;
}
.text-colour a{
color:black;
}
.image-overlay:after {
content: "";
View social_media_acf_shortcode.php
function my_acf_shortcode( $atts ){
$atts = shortcode_atts( array(
'field' => '',
'image' => ''
), $atts, 'showfield' );
if ( get_field( $atts['field'] ) && ( $atts['image'] !== '' ) ) :
return '<a href="' . get_field( $atts['field'] ) . '"><img src="' . $atts['image'] . '"></a>';
endif;
}