Do you also use Spiderfier and Clusterer?
The fitBounds function still doesn’t seem to work and centers my map somewhere along the equator, so I believe it’s the same in your case?
I will probably find a way with a different map script, like Leaflet or Open Street Map, because Google Maps doesn’t seem to recognize this issue and cannot recreate it (I asked for support there too).
Let me know, if you find a different solution 😉
How do you include your styles in the page? it doesn’t work in the style.css but you can implement custom styles by using a styles.php like this:
function my_dymanic_styles(){
$about_color = get_field('about_color', 'options');
$custom_css = "
a{ color:{$about_color};}
";
return my_css_strip_whitespace($custom_css);
}
Put this in your functions.php
function my_css_strip_whitespace($css){
$replace = array(
"#/\*.*?\*/#s" => "", // Strip C style comments.
"#\s\s+#" => " ", // Strip excess whitespace.
);
$search = array_keys($replace);
$css = preg_replace($search, $replace, $css);
$replace = array(
": " => ":",
"; " => ";",
" {" => "{",
" }" => "}",
", " => ",",
"{ " => "{",
";}" => "}", // Strip optional semicolons.
",\n" => ",", // Don't wrap multiple selectors.
"\n}" => "}", // Don't wrap closing braces.
"} " => "}\n", // Put each rule on it's own line.
);
$search = array_keys($replace);
$css = str_replace($search, $replace, $css);
return trim($css);
}
/**
* Dynamic Styles additions.
*/
require get_template_directory() . '/inc/style.php'; //make sure you correct the directory and file path you use
the updated message only gets displayed if the URL parameter ‘?updated=true’ is returned
Unfortunately the ‘return’ parameter for the form doesn’t do that on default, even if it says so in the documentation 😉
short update: after updating ACF 5.6.6 the js issues are resolved, however the form to edit posts does not submit the changes to the database. They are visible in the edit form, when I open it again, new data input is lost, changed data input is visible inside form field but doesn’t appear on the public post itself. totally weird…
I cannot get it to work… tried it with the acf/save_post hook but the file does not get unzipped, I am using a custom directory for the uploads field. this is what I have:
/*
* Adding special uploads folder for VR files
*/
add_filter( 'acf/upload_prefilter/name=vr_files_upload', 'vr_files_upload_prefilter' );
add_filter( 'acf/prepare_field/name=vr_files_upload', 'vr_files_upload_field_display' );
function vr_files_upload_prefilter( $errors ) {
add_filter( 'upload_dir', 'vr_files_upload_directory' );
return $errors;
}
function vr_files_upload_directory( $uploads ) {
$folder = '/vr-files';
$uploads['path'] = $uploads['basedir'] . $folder;
$uploads['url'] = $uploads['baseurl'] . $folder;
$uploads['subdir'] = '/';
return $uploads;
}
function vr_files_upload_field_display( $field ) {
// update paths accordingly before displaying link to file
add_filter( 'upload_dir', 'vr_files_upload_directory' );
return $field;
}
I have tried the WP function unzip_file in a few different ways but that didn’t work. Then I tried the PHP zip functions… still not working…
/*
* @file – path to zip file
* @target – destination directory for unzipped files
*/
function unzip_vr_file(){
$file = get_field('vr_files_upload');
$target = pathinfo( get_attached_file( $attachment_id ) );
// Creating new ZipArchive object
$zip = new ZipArchive();
// Opening the file
$open = $zip->open($file);
//Checking if file has been opened properly
if($open === true) {
// Extracting the zip file
$zip->extractTo($target);
//Closing the zip file
$zip->close();
// Deleting the zip file
unlink($file);
return true;
}
else {
return false;
}
}
add_filter('acf/save_post', 'unzip_vr_file', 10, 3);
Can anybody give me a hint into the right direction? Wasted hours now for finding the correct way of doing this. Would be great to have this in the ACF documentation as there are probably several people wondering the same thing…
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.