Skip to content

Instantly share code, notes, and snippets.

@tdrayson
tdrayson / custom-function.php
Last active September 25, 2022 11:21
Automatically call custom functions in Generateblocks Dynamic Data
/*
* @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 August 23, 2022 09:54
Populate ACF dropdown with Fluent forms
<?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 March 30, 2024 13:00
Fluent Form Custom Dropzone Styling (File / Image Upload field)
/*
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 September 18, 2021 17:21
Make the Fluent Forms Payment Summary Table Responsive for smaller devices like Mobile
/* 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 June 27, 2022 05:29
Fluent Forms 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 November 8, 2020 11:43
If you trying to query the post object field to between 2 CPT's. This condition checks if the repeater is empty or not.
// 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(
//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
// 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' );
/*Image Overlay on Hover*/
.image-overlay{
position: relative;
cursor: pointer;
}
.text-colour a{
color:black;
}
.image-overlay:after {
content: "";
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;
}