ACF_Admin_Field_Groups::get_human_readable_file_location
Returns a human readable file location.
Method of the class: ACF_Admin_Field_Groups{}
No Hooks.
Returns
String.
Usage
$ACF_Admin_Field_Groups = new ACF_Admin_Field_Groups(); $ACF_Admin_Field_Groups->get_human_readable_file_location( $file );
- $file(string) (required)
- The full file path.
Changelog
| Since 5.9.0 | Introduced. |
ACF_Admin_Field_Groups::get_human_readable_file_location() ACF Admin Field Groups::get human readable file location code ACF 6.0.4
public function get_human_readable_file_location( $file ) {
// Generate friendly file path.
$theme_path = get_stylesheet_directory();
if ( strpos( $file, $theme_path ) !== false ) {
$rel_file = str_replace( $theme_path, '', $file );
$located = sprintf( __( 'Located in theme: %s', 'acf' ), $rel_file );
} elseif ( strpos( $file, WP_PLUGIN_DIR ) !== false ) {
$rel_file = str_replace( WP_PLUGIN_DIR, '', $file );
$located = sprintf( __( 'Located in plugin: %s', 'acf' ), $rel_file );
} else {
$rel_file = str_replace( ABSPATH, '', $file );
$located = sprintf( __( 'Located in: %s', 'acf' ), $rel_file );
}
return $located;
}