Support

Account

Forum Replies Created

  • @plinth Hi, This is what I have in my code today :

    $bgimg = get_field('bg_img');
    		if(is_woocommerce()){
    			$bgimg = get_field('bg_img', 75);
    		}

    So as time passed, I guess the is_woocommerce() replace the is_archive(MY-ARCHIVE-ID) and cehck if I’m on a woocommerce page.
    Tell me if it solve your issue.

  • Hmm I think we are not talking about the same thing. While I create a new retailer, I have now two fields : Google maps and a text field. Is the text field supposed to be filled automatically by itself with the zipcode when I validate an address in google maps field?
    I didn’t implement the text field in my template yet so I didn’t try the end-user part.

    This is the code I put in my function.php file :

    // set zipcode to certain field
    add_action('acf/input/admin_footer', 'my_acf_get_address_zipcode');
    
    function my_acf_get_address_zipcode() {
        ?>
        <script type="text/javascript">
        (function($) {
            
            // do this when the map is changed
            acf.add_action('google_map_change', function( latlng, $map, $field ){
                
                // get the address using the geocoder
                acf.fields.google_map.geocoder.geocode({ 'latLng' : latlng }, function( results, status ){
    				
                    // get the zip code from the returned address
                    var address = results[0].address_components;
                    var zipcode = address[address.length - 1].long_name;
                    
                    // set it to a text field
                    $(".zipcode_to_sort input").val(zipcode);
    		    
    			});
                        
            });
            
        })(jQuery);    
        </script>
        <?php    
    }

    This is my setting in ACF :
    Screenshot of the text field in ACF
    And this is a screenshot of 1 retailer post (admin side) :
    Screenshot of google Maps field and Text field

    I also have to tell you I’ve made this a few years ago when the google maps field was an paying add-on called “Advanced Custom Fields: Location Field” as I entered more than 300 retailers I never tried to adapt the code to match with the new google maps field.

  • Hi again James,
    Sorry for my ignorance. I guess I have to add this code to my functions.php page.
    I added the text field in ACF.
    Now if I go to one retailer post, when I change the google maps field, nothing happens…

  • Hi James,
    Quite interesting. Thanks for your quick reply.

    I’m a bit busy on different things right now, but I’ll definitely try it.
    I’ll tell you if it works.
    Many thanks.
    Christophe

  • Ok I found a workaround, it’s well an archive-page that’s called so I added a condition where I call my custom field,

    if(is_archive(MY-ARCHIVE-ID)){
        $mygallery=get_field('MY_GALLERY_FIELD',MY-PAGE-ID);
        ...
    };
  • Hi,
    I have the same issue, with a page_link field. I switched with the post_object and now it works. This means the page link has an issue too.

  • Wesjan,
    I followed your instructions, and it seems to work for me. Thanks for this…so far.
    Happy new year,
    Chris.

  • Ok I figured it out, use Taxonomy field as single value… It was obvious, sorry, a bit tired I think.

  • If I remember well, try to reinstall ACF plugin… I think it did the trick for me.

  • I’m looking for almost the same. A way to show an ACF group to all custom taxonomy terms of a taxonomy. Now I can select each terms but not the taxonomy itself.

  • I guess it’s the same issue then : incompatibility with role user management

  • Hello, I think I have the same problem, I’ve made a website in march 2013 using ACF. In this website, I’ve created a custom post type ‘product’ containing 270 posts. In one ACF Group, I put a rule to show the group to only two posts from product. It’s working fine, but, I’d like to add one new post in the rule and now, my product posts are not shown anymore. The two previous rules are working but don’t show the good info (ex: Post > is equal to > ‘first post of the list’*). *and the list don’t show anymore my products.

    Following the topic here, I checked the registering of my custom post type and at the ‘capability_type’ line, I used this term : ‘content_editor’ accordingly to work with a plugin called ‘map cap’. I deactivated this plugin a put ‘post’ in place of content_editor and it did the trick.

    Now I have to find a way to reactivate ‘Map Cap’. It’s a plugin to manage the right on user types following the custom post types.

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