That is just the ticket – works a treat! Thanks so much for your help!
I just needed to change the Return Format for the date field to Ymd in the backend as suggested.
Thanks so much for your help mediawerk.
Can’t believe it was that simple!
Jonathan, you’re quite right! I must have been too quick to dismiss it last time I tried as I’ve had another go and got it working. Again, huge thanks for your help!
Sorry to be cheeky but I have one last issue I’ve been struggling with that hasn’t received any responses yet: http://support.advancedcustomfields.com/forums/topic/order-repeater-field-rows-by-date/ I don’t suppose you’d be able to help with that?
Hi Jonathan,
Thanks for your help. Your suggestion doesn’t seem to be working unfortunately.
This is what I have in my custom field:
Lorem ipsum dolor: [an-example-shortcode]
Then in my template file I now have this:
while ( have_rows('records') ) : the_row();
echo apply_filters('the_content', get_sub_field('record'));
endwhile;
This is simply outputting “Lorem ipsum dolor: [an-example-shortcode]”
Any other suggestions?
Thanks again
Anyone? Some help with this would be greatly appreciated.
Thank you
Sorry I left this so long but I’ve only just had chance to have a proper go with this code. It’s taken a lot of fiddling to tweak it to my needs but it’s all sorted now – John I can’t thank you enough for pointing me in the right direction!
For others who need to know how to do this, my working code is below. This is a much simpler example where each post has a custom field of “rating”. We want to automatically get the rating from each post and add them all together to give a total rating.
This goes inside your post loop:
// Get Rating Totals
if (have_rows('text_block')) {
$i = 0;
while(have_rows('text_block')) {
the_row();
$rating = get_sub_field('rating');
$ratingsArray[$i++] += get_sub_field('rating');
}
}
This outputs the total rating and should go outside of the loop:
echo array_sum($ratingsArray);
Cheers
The latter.
i.e…
“Do you want to show the total for the competition across all seasons?”
Is this doable?
Thanks again.
Hi John,
Thanks for your help with this so far. Really appreciate it.
Here’s a screenshot showing exactly how the custom fields are currently set up: http://s29.postimg.org/xdinfl287/acf_screenshot.jpg
So these custom fields are filled in for each season (post).
There are 3 competition types, so in each season/post there would be for example:
Competition 1
Goals: 5
Competition 2
Goals: 2
Competition 3
Goals: 4
What I basically want to do is get the total amount of goals for each competition from all seasons/posts. For example, I’d want the total goals across all seasons for Competition 1.
I hope I’m not asking for too much here! Any help would be massively appreciated.
Thanks,
Steve
Any chance of a code example explaining what I’d need to change? I’m a bit of a beginner with ACF!
Not really getting anywhere with that unfortunately. Think I’ll just have to grab the values from each post manually 🙁
Thanks for your help though!
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.