Last active
July 1, 2021 19:27
-
-
Save plugin-republic/9f19211573b9046b596d0eaaca85a48f to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Filter the aspect ratio by field idea | |
* @param $ratio Default ratio | |
* @param $id The field ID in the form, pewc_group_1234_5678 | |
* @param $field The field object | |
*/ | |
function prefix_aspect_ratio( $ratio, $id, $field ) { | |
// Check for our field ID here | |
// Change 8888 to the ID of the field where you want to specify a different ratio | |
if( $field['field_id'] == 8888 ) { | |
$ratio = '16/9'; | |
} else if( $field['field_id'] == 9999 ) { | |
$ratio = '2/3'; | |
} | |
return $ratio; | |
} | |
add_filter( 'wcpauau_aspect_ratio', 'prefix_aspect_ratio', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment