Just to let you know I keep going to this page when trying to post a response, and I have to rewrite my answer which is why it didn’t get posted before – sorry!
The posts are being created by a Gravity Form, using the post update fields.
Hi Sorry,
I’m sure I added the screenshots, I’ll try again on this reply.
Hi James,
I have sent a ticket with a login to the staging site.
I’ll keep this open and when I’ve found a solution, I can share it here 🙂
Thanks, Harry.
You could probably achieve what you originally wanted with some custom PHP, but that’s out of my depth sorry so I can’t help you there.
I’ve not exported content from ACF before and I don’t think it’s possible by any normal methods but here’s where I would look if I wanted to do what you want to do;
As the fields are stored in the database, I would imagine you could move the content by editing the fields metadata in the database, essentially re-assigning where it belongs.
Sorry for the vague answer, it’s all I can think of to help you!
As john said you can use an options page and call the field using;
<?php the_field('field_name', 'option'); ?>
Or if you want to put the fields on one of the pages for usabilities sake (although using an options page would be best practice), you can put the page ID of the page with the fields on as a parameter on the other page like so;
<?php the_field('field_name', 67); ?> <!-- replace 67 with the page ID you want to call the field from -->
Hope this helps, thanks.
Hey James, thanks for your responce.
I disabled all the plugins (Other than the necessary ones like ACF) and the issue was still there.
I’m not getting any errors in the console.
I looked at the page source and the fields are being set to not show (other than the ones that are supposed to be showing).
Here is a screen grab showing this, you can see (attached) in the inspector that the visibility is set to false but they are still displaying.
Thanks.
Hi Sargamgupta,
It’s quite hard to read your code, if you highlight it and select the ‘code’ button on the menu above the text box it will display it in a nicer format and make it easier for people to help you 🙂
It looks like you are returning the alt tag for the image rather than the url, try this instead;
<?php echo $imgObj['url']; ?>
You may want to separate your markup from your PHP which will make it again easier to understand, and also wrap and img tag around your output –
<?php // Show the Gallery
if( have_rows(‘gallery_slideshow’) ): ?>
<div class="projects-gallery-wrap">
<div class="projects-gallery">
<?php // loop through the rows of data
while ( have_rows(‘gallery_slideshow’) ) : the_row(); ?>
<?php $imgObj = get_sub_field(‘image’, $post->ID); ?>
<img src="<?php echo $imgObj[url]; ?>" alt="<?php echo $imgObj[alt]; ?>">
<?php endwhile; ?>
</div>
</div>
<?php endif; ?>
You may also want to check you are outputting the image object and not the URL/ID in the backend.
Let me know how it goes.
Amazing!
So do you mean instead of having;
<?php
$location = get_field('location');
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; ?>
I can just do this;
<?php
$location = get_field('location');
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; ?>
Hi Both!
Thanks for your suggestions, I will try them both today and let you know what I found.
I think one of the issues I’m having with it and why I’m a bit doubtful as to weather this will work or not is I have another map that does need a marker.
I guess a way to get this working is use separate code for a map with a marker and one without? This just feels a little ‘hacky’ if you know what I mean?
Thanks, Harry.
Thanks, could you let me know if there’s a fix released (Don’t worry if not) so I can be sure to update my plugins?
Thanks, Harry.
Hi Jonathan,
Thank you for your reply.
I see, that’s a shame! Maybe a future feature if the WordPress gets updated sometime 🙂
Thanks again, Harry.
I’m also having this issue, I have two repeaters in a group, both with image fields. One works fine, the other only allows certain images to be added. I have deleted and remade the field and re-uploaded images to no avail, would be good to get some light shed on the issue, Thanks.
Sorry, turns out I had things in the wrong order, thanks anyway!
My bad, I had to go through each post and update them one by one, huge thanks for your help and happy holidays!
Thanks, Harry.
<section id="channels" class="container">
<div class="rowOpen clearfix">
<div class="twelvecol">
<div id="masonary" class="nomargin">
<?php
$channels = new WP_Query(array('post_type'=> 'channels'));
while ($channels->have_posts()) : $channels->the_post();
if( ! get_field('show_on_channel_page')){ continue; } ?>
<div class="mason galleryItem">
<div class="img-contain border">
<a href="<?php the_field('channel_link'); ?>" target="_blank" class="img-shiv">
<?php $image = get_field('channel_logo');
if(!empty($image)) {
$imageResized = vt_resize( '', $image, 183, 183, false );
$imageTitle = get_the_title();
echo '<img src="'.$imageResized[url].'" height="'.$imageResized[height].'" width="'.$imageResized[width].'" alt="'.$imageTitle.'" class="statImg" />';
}
?>
</a>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</div>
</section>
(Thought i’d add it without any indents to make it easier to read)
I have added it like so –
<section id="channels" class="container">
<div class="rowOpen clearfix">
<div class="twelvecol">
<div id="masonary" class="nomargin">
<?php
$channels = new WP_Query(array('post_type'=> 'channels'));
while ($channels->have_posts()) : $channels->the_post();
if( ! get_field('show_on_channel_page')){ continue; }
?>
<div class="mason galleryItem">
<div class="img-contain border">
<a href="<?php the_field('channel_link'); ?>" target="_blank" class="img-shiv">
<?php $image = get_field('channel_logo');
if(!empty($image)) {
$imageResized = vt_resize( '', $image, 183, 183, false );
$imageTitle = get_the_title();
echo '<img src="'.$imageResized[url].'" height="'.$imageResized[height].'" width="'.$imageResized[width].'" alt="'.$imageTitle.'" class="statImg" />';
}
?>
</a>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</div>
</section>
and I still can’t seem to get it to work.
Sorry for my incompetence but i’m fairly new to this.
Thanks, Harry.
Hello!
I thought I’d give you an example of CSS as this is what helped me understand it when I was learning.
If you wanted to set the CSS for your ‘ls’ div you would go to your style.css file and add this to it
.ls {
font-size: large;
color: red;
}
This would then change the font size and colour of all text inside the divs and sub divs.
If you wanted to be more specific you can call down the ul/li/a/img etc like so;
.ls ul li {
font-size: large;
color: red;
}
This would then only change the styles of your program field.
Sorry if you already knew all this but I thought it might be useful if not.
Thanks, Harry.
Hi! I’d suggest also checking what your thumbnail sizes are set to as if they could be causing the page to load slowly.
You can find this option in your WordPress Admin area and navigate to Settings -> Media and you’ll see the options to change the sizes.
Harry.
Sweet, thanks @Elliot that worked a charm, I now have an issue with Flexslider not co-operating but I shan’t bother you with questions about another plugin!
Thanks again, Solved!
Harry.
P.S. I accidentally set this to the topic solution when I meant to set Elliots answer as it, i’m happy to change it if you tell me how, sorry!
Hi Elliot! After looking and playing around for a few hours I managed to make this work.
Ill post how for anyone that may be looking at this in the future.
I re-uploaded all my images to WP and into my page and changed my code to –
<!-- Masonry Images -->
<div class="masonry">
<?php if(get_field('images')): ?>
<?php while(has_sub_field('images')): ?>
<?php $image = wp_get_attachment_image_src(get_sub_field('image'), 'full'); ?>
<?php $thumb = wp_get_attachment_image_src(get_sub_field('image'), 'thumbnail'); ?>
<div class="item">
<a href="<?php echo $image[0]; ?>" class="fancybox" rel="gallery_group"><img src="<?php echo $thumb[0]; ?>" /></a>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div><!-- End Masonry -->
I then used Elliots advice of change the output to Image ID and the thumbnails then displayed!
I’d like to thank Elliot for all his help and hope anyone else with this issue found this useful.
Thanks, Harry.
This is now my current code –
<?php if(get_field('images')): ?>
<?php $size = "thumbnail";?>
<?php while( has_sub_field('images')): ?>
<?php $image = wp_get_attachment_image_src(get_sub_field('image'), 'full'); ?>
<?php $thumb = wp_get_attachment_image_src(get_sub_field('image'), 'thumbnail' ); ?>
<div class="item">
<!-- Lightbox Image's -->
<a href="<?php the_sub_field('image');?>" class="fancybox" rel="gallery_group">
<!-- Thumbnail Image's -->
<img src="<?php echo $thumb;?>">
</a>
</div> <!-- End item -->
<?php endwhile; ?>
<?php endif; ?>
And outputs this –
<div class="item">
<!-- Lightbox Image's -->
<a href="359" class="fancybox" rel="gallery_group">
<!-- Thumbnail Image's -->
<img src="Array">
</a>
</div> <!-- End item -->
<div class="item">
<!-- Lightbox Image's -->
<a href="358" class="fancybox" rel="gallery_group">
<!-- Thumbnail Image's -->
<img src="Array">
</a>
</div> <!-- End item -->
<div class="item">
<!-- Lightbox Image's -->
<a href="357" class="fancybox" rel="gallery_group">
<!-- Thumbnail Image's -->
<img src="Array">
</a>
</div> <!-- End item -->
It’s outputting this – http://vn.deckchairdesign.co.uk/wp-content/uploads/2013/10/weddingportfolio-182.jpg
Thanks
Be sure you have added a sub-field to the repeater field and in the sub-field you should see the option you’re looking for! (Sorry if I misinterpreted your question but it is a little vague!)
Harry
I also noticed this in the repeater field Documentation –
Overview
This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.
Description
Deprecated in v3.3.4 – please replace with has_sub_field
Added in v2.0.3
Do I need to change
<?php while( the_repeater_field(‘images’)): ?>
to
<?php while( Has_sub_field(‘images’)): ?>
Thanks.
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.