From the course: WordPress: Advanced Custom Fields

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Writing your block callback function

Writing your block callback function - WordPress Tutorial

From the course: WordPress: Advanced Custom Fields

Start my 1-month free trial

Writing your block callback function

- [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 or parameter, and that's called…

Contents