Display posts from ACF Reverse Relationship using Post Blocks Adv widget
Before configuring the Post Blocks Adv widget, let's first see what actually is Reverse Relationship?
Let's consider an example of Books and Authors. One Author can write many books. Similarly, a book can be written by more than one Author. Therefore, we can set up a direct relationship between Books and Authors and can display the details. But what if you want to display the details of all the books written by a specific author on the Author Detail page, we can get data for this reverse query using the Reverse Relationship feature.
This will require you to create Relationship Field for Post/Page/CPT using the Advanced Custom Fields (ACF) plugin.
You can find more details about ACF - Relationship Field here
Follow the steps below to show Posts from Reverse Relationship on Single Post Layout Drag "AE - Post Block Adv" widget at the desired location in your AE Template. Do the following configuration:
Under the Layout Section:
- Skin: Select the layout style to display the post blocks.
- Block Layout: Select the Block Layout you have created to use in this widget. Learn more about creating block layouts.
Under the Query Section, do the following configuration.
- Source: Relationship
- Relationship Field: Name of the Relationship Field that you have created in ACF. Also, set "Return Format" to "Post ID." By default, it is set to Post Object.
- Reverse Relation: Enable the Reverse Relation option, to get reverse relationship data.
- Do rest of the settings like order by, layouts, etc., as required.
- See the following screenshot for the configuration setup.