log1x / acf-builder-cheatsheet Goto Github PK
View Code? Open in Web Editor NEWA cheatsheet for use with ACF Builder.
A cheatsheet for use with ACF Builder.
I was unable to get anything out of 'elements'
until I formatted it as an array.
This code worked:
'elements' => ['featured_image']
to see all the featured images next to the relationship selection.
Not sure if I'm a noob or if this is written incorrectly in the cheat sheet as it has no array specified, only ''
.
Spent a good while trying to find the solution so if this can help anyone, here it is!
hi Team,
I want to use the addTab method multiple times when building fields.
But I have a problem, when I want to add a tab after endRepeater it doesn't allow, I realized that I need to save the content of each tab in one group before adding the second tab.
Can you help me find out how to not add a group to every tab?
Thanks in advance,
Vahan
Hi there,
I'm developing a project where I need to create a specific list of svg icons selectable from an acf field.
browsing the web I came across this repo https://github.com/agence-adeliom/acf-icon-picker, but I'm trying to figure out how to use it with FieldBuilder.
Do you have any advice?
Thank you in advance,
Fabio
Hi
Thank you for putting togther this repo.
I had an issue when trying to sort out the placement of a group into the side bar and didn't find anything in the docs.
I found the solution here:
use StoutLogic\AcfBuilder\FieldsBuilder;
$banner = new FieldsBuilder('banner', ['title' => 'Sponsored', 'position' => 'side']);
$banner->addTrueFalse('is_sponsored_post', [
'label' => '',
'instructions' => 'Check if this post or page is sponsored',
'required' => 0,
'conditional_logic' => [],
'wrapper' => [
'width' => '',
'class' => '',
'id' => '',
],
'message' => 'This is sponsored post?',
'default_value' => 0,
'ui' => 0,
])
->setLocation('post_type', '==', 'page')
->or('post_type', '==', 'post');
acf_add_local_field_group($banner->build());
It maybe worth just adding this
$banner = new FieldsBuilder('banner', ['title' => 'Sponsored', 'position' => 'side']);
It may help others too.
thanks
Not sure if I am missing this somewhere, but I can't seem to figure out how to implement conditional logic for a field. I tried:
'conditional_logic' => [ 'include_call_to_action', '==', 0],
and:
[ 'include_call_to_action' => 1],
Neither is working. It would be great to have an example that uses conditional logic.
after ->addText('text_field'
As most of the roots sage fans do, we write a lot of acf builder fields. Wouldn't it be interesting to have some snippets to complement the cheatsheet and thus write it faster?
As an example I have:
"ACFB textarea": {
"prefix": "ata",
"body": [
"->addTextarea('$1', ['label' => '${2:$1}', 'new_lines' => 'br', 'rows' => '${3:2}'])$0",
],
"description": "Textarea ACF Builder"
},
Or:
"ACFB group": {
"prefix": "agr",
"body": [
"->addGroup('$1')",
" $0",
" ->endGroup()"
],
"description": "Group ACF Builder"
},
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.