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
/*** Set ACF field default as Post ID for the modal_id field for the video and match CPTs | |
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
function wsv_post_id_default_for_modal_id($post_id) { | |
// Check if we're saving a 'video' or 'match' post type | |
$post_type = get_post_type($post_id); | |
if ($post_type == 'video' || $post_type == 'match') { | |
// Retrieve the current value of the 'modal_id' field | |
$current_value = get_field('modal_id', $post_id); | |
// If the 'modal_id' field is empty, set it to the post ID |
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
[presto_player custom_field="video_url" preset="7" poster="{{field.video_posterframe}}"] | |
https://prestoplayer.com/docs/presto-player-shortcode/ |
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
/*** Create "Event Tag" for Event CPT | |
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
function create_event_tags_taxonomy() { | |
register_taxonomy( | |
'event_tags', // Taxonomy key | |
'event', // Post type name | |
array( | |
'label' => __( 'Event Tags' ), | |
'rewrite' => array( 'slug' => 'event-tag' ), | |
'hierarchical' => false, // Set to false for tags, true for categories |
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
/*** Hide default taxonomy panels for Match CPT taxonomies | |
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
function hide_match_taxonomy_metaboxes() { | |
echo ' | |
<style type="text/css"> | |
#custom_match-status, | |
.components-panel__body:has(>.css-1n451hs.e19lxcc00) { | |
display: none; | |
} | |
</style> |
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
/*** Hide default taxonomy panels for Match CPT taxonomies | |
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
function hide_match_taxonomy_metaboxes() { | |
$screen = get_current_screen(); | |
// Check if the current screen is the 'match' custom post type | |
if ( $screen->post_type === 'match' ) { | |
echo ' | |
<style type="text/css"> | |
#custom_match-status, |
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
/*** ACF filter to allow unsafe html in certain fields (updated for ACF 6.2.5 Security Release) | |
@link https://wpfieldwork.com/diving-into-acfs-latest-security-release/ | |
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
add_filter('acf/the_field/allow_unsafe_html', function ($allowed, $atts) { | |
// Ensure $atts is an array and has the 'field' key | |
if (!is_array($atts) || !isset($atts['field'])) { | |
return $allowed; | |
} | |
// List of ACF field names |
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
/*** ACF 6.2.5 Security Fix | |
@link https://wpfieldwork.com/diving-into-acfs-latest-security-release/ | |
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
add_filter('acf/shortcode/allow_unsafe_html', function ($allowed, $atts) { | |
// Array of field names that allow unsafe HTML | |
$allowed_fields = [ | |
'global_after_body_code', | |
'footer_code', | |
'global_footer_code', | |
'header_code', |
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
Replace the **formid** and **fieldid** | |
/*** Gravity Forms - Restrict the file upload size for Guest Blog form | |
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
add_filter( 'gform_validation', 'validate_file_size_form_name' ); | |
function validate_file_size_form_name( $validation_result ) { | |
$form = $validation_result['form']; | |
// Specify your target form ID |