Created
December 8, 2025 13:43
-
-
Save plugin-republic/0f2875fc722f9d5ce33fc7f5cad3493c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 available fonts for each text preview field | |
| * List fonts in arrays using 'abel' => 'Abel' key / value pairs | |
| * Update the field IDs to match your own | |
| */ | |
| function demo_filter_all_fonts( $all_fonts, $available_fonts, $field ) { | |
| // Update the field IDs below to match your field IDs | |
| if( $field['field_id'] == 1209 ) { | |
| // Make an array of fonts for this field only | |
| $available_fonts = array( | |
| 'abel' => 'Abel', | |
| 'arial' => 'Arial' | |
| ); | |
| } else if( $field['field_id'] == 1307 ) { | |
| // Make an array of fonts for this field only | |
| $available_fonts = array( | |
| 'abel' => 'Abel', | |
| 'courier' => 'Courier' | |
| ); | |
| } | |
| $all_fonts = array_merge( array( 'default' => __( 'Default theme font', 'pr-advanced-previews-addons-ultimate' ) ), $available_fonts ); | |
| return $all_fonts; | |
| } | |
| add_filter( 'apaou_all_fonts', 'demo_filter_all_fonts', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment