Thank you and sorry I’m using the “old fashion not json” way to use ACF blocks…
The CSS file exist because there are no issue on the single post, only when the post is loaded in the modal window.
I guess a callbak is needed after the modal init
Same problem here! And same first try with InnerBlocks ^^
I thought I was doing something wrong…
When I insert the block with the editor, I do not see anything… No button to add blocks.
But when I define a template, I see the blocks :/ But still no “add block” button…
Hi, I actually made one : https://github.com/anybodesign/ad-acf-blocks
It’s somehow a boilerplate, you can take a look
Ok I ended up with a solution, here is the code, don’t hesitate to comment!
<?php $spes = get_field( 'rel_spes', false, false ); if ( $spes ) : ?>
<?php
$types = get_terms( array(
'taxonomy' => 'job-type',
'hide_empty' => true,
'object_ids' => $spes
)
);
foreach( $types as $type ) :
$args = array(
'post_type' => 'job',
'posts_per_page' => -1,
'post__in' => $spes,
'orderby' => 'post__in',
'tax_query' => array(
array(
'taxonomy' => 'job-type',
'terms' => $type->slug,
'field' => 'slug',
),
),
);
$jobs = new WP_Query($args);
?>
<p class="widget-title job-types"><?php echo $type->name; ?></p>
<ul class="sidebar-menu">
<?php foreach( $jobs->posts as $post ) : setup_postdata( $post ); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; wp_reset_postdata(); ?>
</ul>
<?php endforeach; ?>
<?php endif; ?>
Hello, I’m interested in a sample code 🙂
I want to to the exact same thing, but my relationship field is set to return an objet… Is it still possible ?
Thanks a lot!!
It’s perfectlty working 🙂
Oh, you are creating blocks with a UI?
Looks like an ACF repeater field
I use PHP only, in a plugin. So I do not have a specific field pour the preview
It’s just a CSS trick 🙂
I call some CSS for the admin and then:
#editor {
.block-editor-inserter__results {
display: flex;
flex-direction: column;
.components-panel__body:last-child {
order: -1;
border-bottom: 0;
}
}
}
But I’m aware this will only work if my group is the last one 🙂
Thanks @phildesigns but I’ve just tried and all I get is a white placeholder… I would be interested in your full code as well 🙂
Ok I managed to do it 🙂
Using add_row
after the form submission, here is the code:
add_action('acf/save_post', 'fs_sequence_progress');
function fs_sequence_progress( $post_id ) {
if ( ! is_admin() ) {
$seq_title = get_the_title();
$seq_id = get_the_id();
$uid = get_current_user_id();
$row = array(
'page_title' => $seq_title,
'page_id' => $seq_id
);
add_row('pages_ok', $row, 'user_'.$uid);
}
}
Hello,
OK, I’ve thought of a new process 🙂
I’ve created a repeater field to store the pages that have been read.
On the frontend I use acf_form to display the repeater AND two custom inputs prefilled with the page title and the page id.
Now what I need to do is to increment the repeater with the values of the custom inputs…
Any idea how I can do that? with load_field
?
Here are 2 screenshots, profile view and frontend view
Hi 🙂
I’m also interested in providing block preview!
Thanks to @jghazally I tried to add this to acf_register_block
:
'example' => array(
'attributes' => array(
'cover' => ADBLOCKS__PLUGIN_URL . '/assets/fallback.png',
),
),
but I have no preview in the editor, just a spinning loader and then a white space
screenshot attached
Hi!
We also still have this issue, it doesn’t seems to be resolved.
We had an option page with 3 tabs and lots of fields in each tab… after a sync it was totally messed up!
Is there a fix on the way?
thanks!!
hello,
we encounter the same issue here… it’s quite a mess with lots of flexible fields!
what is your workaround exactly?
Hey, thanks for the link Peter, I’ll take a look !
Hello,
I’m also studying the possibility to add a featured image for each site in a network!
Would love to know if there is way to achieve that with ACF, but I’m not sure, as ACF fields are not available in the network admin.
I found this plugin on GitHub: https://github.com/Frosty-Media/ms-featured-image
Maybe it’s worth a try.
Edit: it seems this plugin needs an update… got a fatal error after activation…
Edit 2: OK the fatal error is only displayed until you upload pictures for the sites.
OK John, I solved this out. I added $group to the first return…
if ($group['key'] != 'group_58c6bfd3a0239') {
// not our field group
return $group;
Thanks again for your precious help!
ok, I’m almost there 🙂
I modified the code like this :
add_filter('acf/get_field_group', 'my_modify_field_group_function');
function my_modify_field_group_function($group) {
if ($group['key'] != 'group_58c6bfd3a0239') { // note: I replaced $field with $group
// not our field group
return;
} else {
// add an OR rule to existing location rules for a specific field group
$group['location'] = array(
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'portfolio',
),
),
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'team',
),
),
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'page',
),
),
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'post',
),
)
);
return $group;
}
}
Now it’s working, I have the field group of my plugin available for portfolio and team. But the problem is that I cannot manually create other field groups… They appear inactive, and the fields seems not saved!
the the screenshots without the filter, and with the filter
ok I begin to understand, thanks for your help and patience!
I tried the following, but then I got no more ACF fields in the edit views nor in the acf admin view !
add_filter('acf/get_field_group', 'my_modify_field_group_function');
function my_modify_field_group_function($group) {
if ($field['key'] != 'group_58c6bfd3a0239') {
// not our field group
return;
}
// add an OR rule to existing location rules for a specific field group
$group['location'][] = array(
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'post',
),
),
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'page',
),
),
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'portfolio',
),
),
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'team',
),
),
);
return $group;
}
ok thanks!
but I can’t use it that way:
add_filter('acf/get_field_group', 'my_modify_field_group_function');
function my_modify_field_group_function($group) {
'key' => 'group_58c6bfd3a0239',
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'portfolio',
),
),
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'team',
),
),
)
return $group;
}
I think I have to add the field group ID?
Hello John,
Thanks for your answer, I think a filter is what I need but I’m not sure how to modify $group
…
I think I have to add this (my 2 CPT) :
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'portfolio',
),
),
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'team',
),
),
)
But I don’t know how 🙁
Thanks a lot James !
I can order now the outpout on the front-end 🙂
I update my code like this :
$the_problems = get_field('related_taxo');
$order = array();
foreach( $the_problems as $i => $problem ) {
$order[ $i ] = $problem->count;
}
array_multisort( $order, SORT_ASC, $the_problems )
thanks
Hello,
same issue for me 🙂
just rolled back to 5.1.9 until 5.2.1 fix that issue !
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.