Thanks John. I will try this asap.
Arrgh! Wrong button. Doesn’t look like I can edit the “This solved my question” label. Sorry.
That’s brilliant. I hadn’t thought of a shared core json folder. Thanks a lot.
Hi John,
They are self-standing themes (however if a client need some customization I would implement that via a child theme).
My aim is to have a core ACF setup that I can tweak if a theme requires it. Right now I have used the admin UI to register the field groups. Ideally ACF would have a native “If current theme is xxxxxxx” location rule.
Eventually the fields will be deployed on the sub-sites of a multisite network which I hope will not add too many constraints (had to start this project somewhere and it wasn’t there).
Actually no-field layouts work too.
Each layout is named after a specific module and as I loop through them I load the corresponding template part.
I will just need to hide the Open/Collapse toggle button.
Thanks John.
That’s the logic I had in mind. I wouldn’t even need to get the fields for each group. All I need is to output a client-ordered loop that allows me to conditionally get template parts (with content from option pages).
I could even use multiple select field – the stylized UI is a pretty neat way of adding, removing and ordering items – but I couldn’t work out how to sort that foreach loop either.
A Flexible Content field may well have to be the way to go. I am little concerned that it will result in a complex page and a lack of clarity for my client.
I also wish I could make some layouts read-only layouts (for add-on modules that are available for purchase).
WP Rest-API and Ajax is apparently a solution.
Someone kindly put this together for me:
https://gist.github.com/airesvsg/2710de81f09613c456277ae3e38c2358
Haven’t tested it yet.
Someone offered up this REST API and AJAX solution.Haven’t been able to test it yet. https://gist.github.com/airesvsg/2710de81f09613c456277ae3e38c2358
I presume you cache your pages. How do you get past the cache so that the header images changes upon refresh?
That seems to have worked.
Thanks.
Had to roll back to 5.4.2.
Of course! My mistake: I was thinking 5.4.3.1 or whatever comes next.
Still getting ReferenceError: Can’t find variable: tinymce in acf-input.min.js:3:7916
Might be staring at me but I don’t see the 5.4.3 RC1 version.
I worked it out:
<ul class="col-md-6">
<?php $i = 0; $j = count( get_field('repeater_field') );?>
<?php if( have_rows('repeater_field') ): while ( have_rows('repeater_field') ) : the_row(); ?>
<?php the_sub_field('sub_field'); ?>
<?php if ( ( $i + 1 ) == ceil($j / 2) ) echo '</ul><ul class="col-md-6">'; ?>
<?php $i++; endwhile; ?>
<?php endif; ?>
</ul>
John,
Could you please complete the code and show how you create the ul elements and loop through each array?
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.