Hello John,
That’s what I suspected which isn’t ideal although I appreciate that there will be an opportunity cost of features like this versus the complexity of the underlying code. Perhaps something to add to the wishlist?
Hello Luukx20, I couldn’t get your suggestion to work.
If I clone a radio field in the same field group (flexible content) but sitting in a different layout I cannot use the conditional logic options irrespective of whether it’s seemless or group. I just see “no toggle fields available”. Perhaps I’m doing something wrong but I can’t see how conditional logic can be used on a cloned sibling field.
Very happy to be pointed in the right direction but toggling between group and seamless doesn’t appear to make any difference.
Hello John,
Thanks for the response, I think on balance it’s easier for me to query the options table directly:
$terms = $wpdb->get_results( "SELECT CAST(TRIM(TRAILING '_offer_pages' FROM (TRIM(LEADING 'offer_category_' FROM option_name))) AS INT) AS term_id
FROM ".$table_prefix."options WHERE option_name LIKE 'offer_category_%_offer_pages' AND option_value LIKE '%\"" . (int)$page_id . "\"%'");
Interested to hear feedback on this but this will give me the term id’s I need which I can then hook back in to the ACF and WordPress functions to pull out the related offers.
Many thanks
Andy
Hello James,
Yes I could use an additional field but there is no easy (automated) way of making this unique to the block: it would need to be manually maintained.
The identifier doesn’t need to be a slug, just some form of unique id; I’ll find a way to work around the problem but could this be added to the feature requests?
Hello John,
Thanks for your time and responses, as this isn’t really a bug I’ll mark your last response as a solution.
Is there any reason that a normal nested repeater can call get_field within has_rows() but get_sub_field has to be called outside of has_rows() for a repeater inside a flexible content field?
Many thanks
Hello John,
You pointed me in the right direction – turns out it also cannot be called after has_rows(), so the solution looks like this:
$rows = get_field('carousel');
$row_count = count($rows);
if( have_rows('carousel') ){
<!-- do some count based stuff here -->
while( have_rows('carousel') ): the_row();
<!-- do some other stuff here -->
endwhile;
}
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.