Because WordPress doesn't know how to display the new block you created, you need to tell it how. In this video, define the callback function from earlier by generating a usable slug for your block and then including a new template part, which is used to output the block’s markup.
- [Instructor] Defining the block and field group … is only one part of the equation. … We now need to tell WordPress how to display our block, … both on the front and back end. … In our child themes function dot PHP file, … let's go ahead and define a constant. … This constant is going to be our template path. … So we'll type define as the function name, … and then we'll name the constant LIL underscore path. … The value will be the style sheet directory. … We're first going to call the function trailing slash it, … and that's all one word, to make sure that we have … a appropriate trailing slash on the end of our path. … Then we'll call the WordPress function … get style sheet directory. … Now we won't have to worry … about typing this long function name … and instead can just type LIL underscore path. … We'll close up our definition. … Now it's time to define our callback function. … So we'll type function, LIL, … render, fun facts block. … And this function is going to accept one argument …
- What are custom fields?
- Creating field groups
- Adding content to fields
- Displaying fields on a child theme
- Creating and displaying repeater fields
- Creating a submission form
- Creating a Gutenberg block with PHP only
- Writing rules for field display
- Organizing fields
- Exporting field groups
Skill Level Advanced
1. Getting Started with ACF
2. Creating Field Groups with ACF
Field types overview3m 48s
3. Displaying Your Fields
4. Working with Data in ACF
5. Creating a Gutenberg Block
6. Cleaning Up the Admin
Next steps1m 13s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.