What are you doing inside your pre_get_posts action? I don’t believe it’s the pre_get_posts action that’s causing the problem. If I just have it echo out some text, get_field returns an array of images as expected. It’s when I modify the query by adding $query->set( 'meta_key', date_published' ); that I run into a problem.
Hello again. A guy at my hosting company tried around a bit and came to the conclusion that if you put the post ID in the has_sub_filed();/the_sub_field(); the data shows. Like it doesn’t know where it is assigned to?
Like this (the “73”):
<?php while(has_sub_field("segment_servicepriser", 73)): ?> <h3><?php the_sub_field('segmentrubrik', 73); ?></h3> <ul class="artikel bigbox list">
<?php while(has_sub_field('artikel', 73)): ?>
<li>
<ul>
<li class="con60"> <?php if(get_sub_field('namn', 73)){ echo the_sub_field('namn', 73); } else { echo '-||-'; }?> </li> <li class="con20 right"><?php the_sub_field('pris'); ?>:-</li> <li class="con20 info right"><?php the_sub_field('info'); ?></li> </ul>
And so on… The 73 is the current ID of one of the pages spitting this date out. So if I want the same data to spit out somwhere else I have to put that ID in too.
I can’t recall that this was an issue before?
What do you think?
thanks again
regards / Jeppe
I’d still be interested to see a tiny code snippet showing how a call to a custom field (say, Rating, for example) would look. That’s it.
Thanks again.
@Elliot Any plans to develop a csv importer tool specifically for ACF, or even publishing a document on ‘how to’ ?
I’ve noticed that Woo has created an importer for their Woo Commerce product:
http://www.woothemes.com/products/product-csv-import-suite/
Nice price too 😉
I would have no qualms lining your palms with a similar amount 😉
And WP Types explains the ins and outs here:
http://wp-types.com/documentation/user-guides/how-to-import-content-into-wordpress-using-csv/
We have tried, unsuccessfully, using the WP All Import plugin and some of the others seem a bit flaky at best.
$post->ID does return value in the previous code yes. I tried with and without $post->ID appended to get_field call.
This page has a good summation of why I was using a separate WP_Query class object – http://www.binarymoon.co.uk/2010/03/5-wordpress-queryposts-tips/
Using a get_posts approach did not change the result but included for future reference anyone else – based closely off the example on get_posts template tag codex page.
$args = array( 'post_type' => 'highlight',
'posts_per_page'=> $count,
);
$highlights = get_posts( $args );
if (count($highlights)) {
$output = "<div id='highlights'><ul>";
foreach ( $highlights as $post ) : setup_postdata( $post );
$output .= "<li>";
$output .= get_field('highlight_call_to_action', $post->ID) . "<br/>";
$output .= get_field('highlight_call_to_action') . "<br/>";
$output .= get_post_meta($post->ID, "highlight_call_to_action", true) . "<br/>";
$output .= "</li>";
endforeach;
$output .= "</ul>";
wp_reset_postdata();
}
In either loop format case using get_field_object with / without the preceeding _ returns a blank shell response. Whether $post->ID is appended or not. Glad to have a temporary working solution, but would obviously prefer to make use of the ACF output fields as I get into more advanced uses with it.
Got it! …just in case anybody else wants to know how to implement the flexslider in wordpress:
So:
1) create a folder named “css” inside your theme folder
2) create (or use if you already have it) a folder named “js”
3) download flexslider from the links mentioned above (on woothemes site)
4) unzip de flexslider archive on your computer
5) copy the flexslider.css file to the “css” folder you created above
5) copy the jquery.flexslider-min.js file to the “js” folder you created above
6) in your template, use the code provided above by Brad.
Hope it helps 😉
Puiu D.
Hi Elliot, I’ve checked this again, and all appears to be fine now! So I’m not quite sure what this could have been, whether its just a case of needing to log out/in after updating I’m not sure. But I’ll keep an eye on it just in case it occurs again and do a full debug if it does.
Cheers for looking into it though, apologies for the false alarm!
Thanks,
Adam
Hi!
Great support for this issue. Thanks.
Working version is Versions:
4.2.2 ACF Core
1.0.2 Flexible Content Field
1.0.1 Repeater Field
Wondering what this is:
What’s new
Core: get_field can now be used within the functions.php file
If you could not before, something with the scope should have been changed?
We are in the middle of late working nights right now to rollback all the projects that been affected by the auto update by the admins all over. ACF has a hight update freq, and has Always been stable, relyible. Its one of the few plugin we update without do the testdrive on each install first.
As soon as p, within a few days, I will do the die() trace, but it so much easier if we get a understanding of the changes in the latest version. This is where we need to track what the latest update does diffrently:
// loop
$other_page = get_the_id();
doit($other_page)
function doit($other_page){
while(has_sub_field('repeater_field_name', $other_page))
if(get_sub_field('sub_field_1')){
while(has_sub_field('flexible_field_name', $other_page))
if(get_row_layout() == 'row_name_1'){
if(get_sub_field('posts')){
foreach(get_sub_field('posts') as $p){
$new_other_page = $p->ID;
goto_function_write_post($new_other_page);
function goto_function_write_post($new_other_page){
$obj = get_post($new_other_page);
$other_page = $obj->ID;
$ACF = get_post_meta($other_page, 'repeater_field_name', true);
if($ACF) doit($other_page);
}
It is a brain resoucing procedure … If you cant see anything particular in this chain that might couse a global scope, then give me a hint.
Otherwise I come back within a few days and report my tracking / comparing versions output, and we go from there with this thread.
Thanks so far!
It did not solve, although the code of that topic was tried…
The problem was solved when the downgrade was carried out to ASF4.1.8 which works by WP3.5.2.
Thank you!

Hi @ishikawa
Have you solved this by downgrading?
The ‘Add row’ label issue has been solved and a new version will be out soon for this. There is a fix here: http://support.advancedcustomfields.com/forums/topic/add-row-button-label-missing/
I will try it in chrome and see if I too have the same experience
Thanks
E

Hi @kamullis
This should help:
http://www.advancedcustomfields.com/resources/faq/wysiwyg-field-appears-without-toolbar-buttons/
Thanks
E

Hi @Idealien
I see 2 issues with your above code:
1. Your post_meta function use the $post->ID, however your get_field does not
2. Your setup_postdata() function may be causing the issue.
Does your line work correctly:
$output .= "<strong>ID: " . $post->ID . "</strong><br/><br/>";
Can you also read over the WP docs to see some code examples of loops. Perhaps the get_posts function will be clearner?
Thanks
E

Hi @Ron Willemse
I’m not 100% sure, but I think your code should be something like this:
<?php
// vars
$current_term = $wp_query->queried_object;
// use get_field to find the related taxonomy.
$related_term = get_field('field name from taxonomy shops ', $current_term->taxonomy . '_' . $current_term->term_id);
// Depending on the return type setting (ID / Object), you need to then use that data to load the field from.
$related_term_field = get_field('field_name', $related_term->taxonomy . '_' . $related_term->term_id );
echo $related_term_field;
?>
If that deosn’t look write, perhaps you could clearly define the steps needed to get the data you want from the current taxonomy term?
Thanks
E

Hi @popmouth
Because ACF uses the native and core WP attachment functionality. In theory, you should be able to find an attachment password protect plugin and it will work with ACF.
Good luck
Thanks
E

Can you comment out 1 of the add-ons? Which one includes the jQuery migrate code?
What versions of each add-on are you using?
Thanks
E

Thanks for the bug report.
I’ll add this to the to-do and find a solution which uses a WP function to do the like escape.
I have a feeling that making this change to such a core function could effect some servers.
I’ll let you know when I have some code to test!
Thanks
E

Hi @stefanluk
If you have selected the return format of ‘file object’, the your code won’t work. Your code expects the value to be an ID.
For example, your code $url = wp_get_attachment_url( $attachment_id ); requires $attachment_id to be an integer. However, if you have selected ‘file object’ as the return setting, this will NOT be an integer!
Please read the docs and debug your code to see what data you have available on each line.
Thanks
E

Hi @paulb
Here is what your code hsould look like:
<?php
$i = 0;
$min = 4;
if(get_field('featured_listing')) : ?>
<?php while(has_sub_field('featured_listing')): $i++; ?>
<div class="promo">
<h3><a href="<?php the_sub_field('featured_url'); ?>" target="_blank"><?php the_sub_field('featured_name'); ?></a></h3>
<div class="button"><a href="<?php the_sub_field('featured_url'); ?>">Visit website</a></div>
</div>
<?php endwhile; ?>
<?php endif: ?>
<?php if( $i < $min ): ?>
<?php for( $j = 0; $j < ($min-$i); $j++ ): ?>
<div class="promo empty">
<p>Nothing to see here, why not <a href="#">add a promo</a>?</p>
</div>
<?php endfor; ?>
<?php endif; ?>
Please note I have not tested this code, but you can see how the logic should work.
Thanks
E

Hi @Agrajag
Thanks for the follow up. Can we mark this topic as resolved, or do you have any other queries?
Thanks
E
Sorry, I tried downgrade of the plug-in.
Thank you.
Think I solved it. Works anyway
<?php if(get_field('slideshow_images')): ?>
<div id="myCarousel" class="carousel slide carousel_banner">
<div class="carousel-inner">
<?php $z = 0; while(the_repeater_field('slideshow_images')): ?>
<?php $z = $z + 1; $image = wp_get_attachment_image_src(get_sub_field('image'), 'full'); ?>
<div class="<?php echo ($z==1) ? 'active ' : ''; ?>item" style="background-image: url(<?php the_sub_field('image');?>);">
<div class="container">
<div class="carousel-">
<h1><?php the_sub_field('title');?></h1>
<h3><?php the_sub_field('sub_title');?></h3>
<a class="btn btn-large btn-primary" href="<?php the_sub_field('image_links_to');?>"><?php the_sub_field('links_to_text');?> <i class="icon-chevron-right"></i></a>
</div>
</div> </div>
<?php endwhile; ?>
</div>
</div><!-- /.carousel -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">›</a>
<?php endif; ?>

PLEASE UNSOLVE. I didn’t choose a solve option.
I think I may have answered the first question myself as I can see I can choose to add an ADD statement and choose to show ACF’s only if the post category is Product.
Below is what needs repeating
<div class="item active" style="background-image: url(<?php the_sub_field('image');?>);">
<div class="container">
<div class="carousel-">
<h1><?php the_sub_field('title');?></h1>
<h3><?php the_sub_field('sub_title');?></h3>
<a class="btn btn-large btn-primary" href="<?php the_sub_field('image_links_to');?>"><?php the_sub_field('links_to_text');?> <i class="icon-chevron-right"></i></a>
</div>
</div>
</div>
found one more issue .. when using the Basic File field on a front end form and the field not required, a new (empty) attachment is created even if no file is uploaded by the user
btw, i’ll keep logging them here to keep the issues together, but let me know if you’d rather i open a new post to compile the issues i’m finding
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.