This works however, not if you don’t want margin/padding on for other blocks. The above method will turn it on for all blocks. You’ll have to assign your acf block within the theme.json and give it custom elements like so…
"settings": {
"blocks": {
"acf/acf-block-name": {
"spacing": {
"margin": true
}
},
}
},
This will bring up the detail just for your acf block.
However, I am not having the problem that the margin setting I’ve chosen is just adding the number to the inline style and no measurement i/e 20px it just adding margin-top: 20;
Here is a link to my full front end Google map display with the various ACFs.
Its when you click the file input and it brings up the media upload.
If you try and select a file from the media library that you banned it is greyed out.
If you then click before and after that and multi select from the media library it allows the restricted file to be chosen.
Hi cplumley
Kind of, i just want a list of checkbox buttons which list the CPTs, which you can select.
Dont need anything specifically from the CPT choice, well perhaps just its name and permalink.
So you’re on CPT a, and a side box has a list of checkboxes that is pre-populated with just the names of CPT b. Then front end on CPT a single page it shows the list of the ones you’ve chosen and a link to them.
Hi cplumley, thank you for that. 🙂
I kind of understand but not sure how to link or target a specific field type?
For example i create a radio field called ‘services_select’ and that only appears on CPT a but it needs to auto pupulate from CPT b.
Where do i let it know that its targeting ‘services_select’ and populating from CPT b
Brilliant, thank you John.
I’ve a repeater/flexible content and it has 2 rows in it, i want it to show a certain div however, if its only got 1 i want it to show another.
Whatever i try it always adds it to the first row even if there is 2, when i only want it to add to the first one if thats the only one, not the first one of 2.
Does that explain better?
Hi, thank you for that.
Will that for a single image as well as within a foreach galley?
If possible can you explain this bit…
if( $image == null ) return;
echo $image['alt'] ? $image['alt'] : $image['title'] ? $image['title'] : 'No ALT-Tag';
Why no IF tags, is it just reading through and will spit something out when it finds it there?
Brilliant works perfectly, thank you 🙂
Seems to be some rather disturbing rumours/news that this might just remove all meta boxes from the post/page editor screen.
Surely this would be ridiculous and break an alarming amount of plugins?
Surely this is not a serious suggestion?
Has this been incorporated yet?
Thank you John, so loading via PHP and JSON is essentially the same is that what you mean?
Interesting idea to always have a JSON copy of the php export just incase, i assume storing this in the theme but not importing wouldn’t slow anything down?
Thanks John, interesting.
So i using the php why would probably be best if you wanted some further interaction with WordPress, the JSON way if its just a plain old field.
Speed wise, both similar and quicker (front end and back??) than a default ACF done in the admin?
Brilliant thank you John.
Thank you James.
Yes i looked at that but couldn’t figure out and got confused by the..
'orderby' => 'meta_value_num’,
and 'compare' => '=‘,
sections of the query bits.
Brilliant thank you, that works a treat.
So i just had the meta query in the wrong order?
Perfect thank you 🙂
Thank you John, unfortunately its not working.
The custom tax is called ‘area’ which has two categories within.
When try your code with ‘area’ put in ‘your-taxonomy-slug’ i get a fatal error and the admin page doesn’t load completely..
Fatal error: Call to undefined function get_post_terms() in functions/inc/acf.php on line 71
Line 71 is..
$terms = get_post_terms($post->ID, 'area', $args);
Sorry yes.
So currently the relationship selection box shows the lists of posts and their featured image, i would like it to show the custom taxonomy name that post is assigned to.
So if the post is assigned to the custom tax cat 1 and cat so, they are showed along side its name.
Does that explain it better?
Thank you John, but that brings up an error.
Basically i want the relationship field to show the post name as well as the custom tax its assigned too.
I tired your code but got an unexpected end error code.
Thank you John.
Thanks John.
Incase anyone is interested here is my code…
<?php
$rows = get_field('tab_test');
echo '<pre>';
var_dump( $rows );
echo '</pre>';
if (have_rows('tab_test')) {
echo'<ul class="nav nav-tabs" role="tablist">';
while(have_rows('tab_test')) { the_row();
$tab_button = get_sub_field('tab_button');
$tab_id = get_sub_field('tab_id');
echo' <li role="presentation"><a href="#'.$tab_id.'" aria-controls="'.$tab_button.'" role="tab" data-toggle="tab">';
// output sub field content
echo''.$tab_button.'';
echo'</a></li>';
}
echo'</ul>';
// reset the rows of the repeater
reset_rows();
echo'<div class="tab-content">';
// second loop of same rows
while(have_rows('tab_test')) { the_row();
$tab_button = get_sub_field('tab_button');
$tab_content = get_sub_field('tab_content');
$tab_id = get_sub_field('tab_id');
echo'<div role="tabpanel" class="tab-pane " id="'.$tab_id.'">';
// output sub field content
echo''. $tab_content.'';
echo'</div>';
}
echo'</div>';
}
?>
Thank you John, not 100% sure how to go about those code wise but i’ll have a look..
Seems like a false alarm, a browser re-start seemed to get it working fine.
Was fine in other browsers as well, apologies..
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.