Support

Account

Forum Replies Created

  • Thanks a million John managed to figure it out in the end I was missing the post id at the end of the short code call
    Cheers for coming back to me on this really didnt expect it after 2 years thanks again 🙂
    Heres how the code looked in the end

    <img src="[acf field='list_of_sdgs_0_sdg_icon_image']" /> <a href="[acf field=">[acf field="list_of_sdgs_0_sdg_name"]</a>: [acf field="list_of_sdgs_0_sdg_purpose"]
    
  • Hi John / ericaeide

    Chances are that this wont get answered as its been 2 years since the initial post but you never know 🙂

    Im having issue calling a repeater field with the above code can you have a quick look at what im doing and let me know where I have gone wrong?

    —-SET Up—-

    Created New Field Group called test list and attached it to a page using the rules

    The first item is called list items (field name list_items) this is set to repeater

    The next field in the repeater is called item and its just plain text (field name item)
    The next field in the repeater is called item image its just plain image upload (field name item_image)

    The short code im using to call this onto another page is as follows

    [acf field="list_items_0_item"]

    It calls on the list page but i cant seem to pull that list into another page by using that shortcode do I need to reference the page id?

    Should this be returning all the items I have entered?

    Thanks in advance for your help if you get this 🙂

  • Hi @James

    it looks like you solved this issue above and I was wondering if you could assist with mine its along the same lines when you have a chance.

    I have created a custom field with map loaction this is attached to a category in of posts.
    Ideally what i want to happen is elements of the post display on the map inside the pointer window when clicked.

    Im building out a wordpress site that plots custom data on a google map using Advanced Custom Fields Pro but can’t get it to generate the map using the custom page I have created.

    I have created a Google Map Picker with ACF which I have assigned to a post category type ID 4. This is functioning as expected and I can pick the location for each post

    In my custom template for wordpress site I have entered the below code to call any location information from the Category in question in this case its ID is 4

    This Section pulls and displays the location as expected on the page ( I will be hiding it in the final build)

    <?php
    $catquery = new WP_Query( 'cat=4&posts_per_page=10' );
    while($catquery->have_posts()) : $catquery->the_post();
    ?>
    
      <?php the_field('location'); ?>
    
    <?php endwhile; ?>
     </div>

    However the map just pulls the first blog and does not display the other Below is the code im using to call the location and pass it into the map

    <?php if( have_rows('sdg_location') ): ?>
        <div class="acf-map">
            <?php while ( have_rows('sdg_location') ) : the_row(); 
    
                $location = get_field('location');
    
                ?>
                <div class="marker" data-lat="<?php echo $location['lat']; ?>" 
        data-lng="<?php echo $location['lng']; ?>">
    
                </div>
        <?php endwhile; ?>
        </div>
    <?php endif; ?>

    Can you advise of a better method of doing this? Is there a way to pass the location from the categories directly into the map call?

    Thanks a million for your help in advance

  • Hi @lowercase
    Quick question for you. How did you manage to get your orignal code to work with out referencing the post ID the only way I can get mine to display a single post is to included the post id
    Im using ACF & CPT UI plugins
    Cheers for the advice in advance 🙂

    <?php 
    
    $location = get_field('location_now',22);
    
    if( !empty($location) ):
    ?>
    <div class="acf-map">
        <div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>"></div>
    </div>
    <?php endif; ?>
    

    My aim is to create a stand alone map that loops all the map points but I cant seem to get the template file to work

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