Tag Info

Hot answers tagged

2

Simply use get_sub_field("session_speaker"); function to retrieve that data. As you've said this is a relational field, it will return an array of post objects according to the docs. In order to get data from each speaker, you need to loop through the resulting array. Example: $speakers = get_sub_field("session_speaker"); if ($speakers && ...


1

In this situation I would use the page as a placeholder to configure the sidebars, even though WordPress will completely ignore it on the front end. Just add the page, make sure the slug is trainings, let the client set it up as they need, and then in your template: if ( $trainings_page = get_page_by_path( 'trainings' ) ) { $acf_sidebars_data = ...


1

You're close - couple of things: $field is an array representation of the field, so you need to use $field['name'] which is the name of the field. get_field will format the value unless you set the third argument to false - we want the ID, not the post object/URL (or whatever setting you configured for your field return value) Your code won't delete the ...



Only top voted, non community-wiki answers of a minimum length are eligible