Created
July 24, 2019 08:20
-
-
Save MaximeCulea/86b0834a2768a01706e56d7fd1391806 to your computer and use it in GitHub Desktop.
Customize ACF fields and options.
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 | |
/** | |
* Hide ACF Edition buttons for repeater for publication_most_commented, etc | |
*/ | |
function admin_print_scripts() { | |
echo "<script type='text/javascript'>jQuery(\"[data-name='publication_most_commented'], [data-name='publication_by_user'], [data-name='publication_most_liked']\").find('.acf-actions, .acf-row-handle').hide();</script>"; | |
} | |
add_action( 'admin_print_footer_scripts', 'admin_print_scripts' ); | |
/** | |
* Disable fields for edition | |
* | |
* @param array $field | |
* | |
* @return array | |
*/ | |
function disable_field( $field ) { | |
$field['disabled'] = 1; | |
return $field; | |
} | |
add_filter( 'acf/load_field/name=group_most_active', 'disable_field' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment