Support

Account

Forum Replies Created

  • Hi again. Many thanks but sadly I have some others questions….

    1) Inside the ‘acf/save_post’ hook the statement…

    $_POST['acf']['field_abc123'];

    … retrieve the new posted value of a certain field.

    Consider if the admin doesn’t write any new data inside that field in that post saving… that post value would fall back to the old posted value, or it will be simply empty?

    2) What do you mean that the gallery field would not return what I expect? Is that
    inconsistency normal?

    Many thanks!

  • Hello James and thanks for giving a hand!

    I find interesting this “update_value” filter but I think that the “save_post” is more suitable to my needs, as long I can put all fields logic in only one function.

    How can I access a specific field old and new posted value in acf/save_post action???

    Maybe:

    function my_acf_save_post( $post_id ) {
        
        // specific new field value
        $new_value = $_POST['acf']['field_abc123'];
        
        // specific old field value
        $old_value = get_field('custom_field_name', $post_id);
        
    }
    
    // run before ACF saves the $_POST['acf'] data
    add_action('acf/save_post', 'my_acf_save_post', 1);

    PS: Also can I use get_fields() instead get_field() in order to get all fields old values??

    Regards!

  • 2 weeks and no response… Please if there is no multisite-support at least clarify that info in documentation. Please as a customer I want an answer. Thanks.

  • Hmmm… sorry but we are wrong

    There are not weak points in WP, most of cases WE are our own waekness…

    I pass these days searching in tons of sites… and WP surprise me, again.

    WP_Query

    This above function is the most impressive piece of art that I have ever read. This allow you to crawl all over the site content, and find averything you want… also allow filtering by tazonomies, tags and custom fields.

    Now I have a full working searchbox, with crazy customizations.

    If someone is interested I’ll try to explain the basics…

    Thanks WP for the tools, thanks ACF for keep all in order

    PS: Now… trying to make it by Ajax… coffee!!! 😀

  • Also, right click over a map point: click option “What’s here?”

    In the search input will appear the coordinates…

  • Hi. I not use that plugin. My way to include maps is by using pure google api code…

    Put in some place of your php file the script file:

    <script>
    function initialize(){
    var place = new google.maps.LatLng(<?php the_field('coordinates');?>);
    var mapOptions = {zoom:2,center:place,streetViewControl:false,mapTypeControl:false,mapTypeId:google.maps.MapTypeId.ROADMAP};
    var map = new google.maps.Map(document.getElementById('map'),mapOptions);
    var marker = new google.maps.Marker({position:place,map:map,title:"<?php the_field('mapdesc');?>"});
    }
    function loadScript(){var script = document.createElement('script');script.type = 'text/javascript';script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&' + 'callback=initialize';document.body.appendChild(script);}
    window.onload = loadScript;
    </script>

    Explain:

    â–  var place = new google.maps.LatLng(<?php the_field('coordinates');?>);
    Here the script will determinate where to place the map, so the LatLang as the name means read the Latitude and Longitude that you put there and create a place where later the map will be centered there.

    So I create a text field with name coordinates with the coords of my desired place.

    â–  new google.maps.Marker({position:place,map:map,title:"<?php the_field('mapdesc');?>"});
    More customization. Text field with place description (“mapdesc”). Optional.

    â–  document.getElementById('map')
    Here the script is searching throught all the dom looking for an element with id “map”. So in some place of your code, put an div element with id map like this:
    <div id="map"></div>

    â–  Remember to style de map element. Give a certain height and width by css if necessary.

    This always works for me and here you have the Google Maps Javascript API v3, for more tricks and customization: https://developers.google.com/maps/documentation/javascript/

    Hope I help!

Viewing 6 posts - 1 through 6 (of 6 total)