Post_object
Last updated
Last updated
The Post Object field type (e.g. ACF Post Object) creates an interactive dropdown to select one or more posts, pages, or custom post type items. This field type uses the Select2 library to enable search and AJAX functionality.
In the Lite version, if you add these fields to your View they will be displayed as links. For example you could use the field to link to a different post or post type or to create a read more link.
Sometimes, instead of displaying the selected post as a link, you may need to display some fields of the selected post with your current View. With the Pro Edition, you can do this.
To display post details, follow these steps:
Use the AVF Pro Edition: Ensure you have the AVF Pro edition, which allows you to customize the appearance of object fields.
Create the Primary View: Start by creating the main View, which will act as the master View. Choose the target post_object field as save the View.
Create a ‘Post Details’ View:
This View will be responsible for displaying post details.
In the Fields tab, select the post fields you want to display, such as the WordPress excerpt and Featured image.
Save the 'Post Details' View: After setting up the fields, save the 'Post Details' View.
Link the Views:
Go back to the primary (master) View.
In the post_object field settings, select the 'Post Details' View in the 'View' setting.
Save the Master View: Save the master View to complete the setup.
Customize as Needed: Now, each chosen post in the post_object field will be displayed according to the 'Post Details' View. You can further customize the markup and add CSS styles as needed.
That's it! By following these steps, you can display detailed term information and have full control over the layout and styling.
Use a Relational field to 'link' two Custom Post Types (CPT) together. Combine it with a Meta Filter (Pro) to display related content.
Post (WordPress) Group Author field and Taxonomy terms (WordPress) Groups also have the option to choose a View.
To display all the items in a single row, you can use the CSS Flexbox:
To display all the items as a grid, you can use the CSS Grid:
To display items as a grid, start by creating a detailed layout for each item by assigning a View, as described above. Once your item layout is set, you can transform the display into a grid using CSS Grid. Simply add the following CSS code to your View to achieve the desired grid layout:
Make sure the class in the CSS fits the field class from the markup. By changing the value of the grid-template-columns property, you can control the number of columns in your grid.
AVF comes with a set of pre-configured JS libraries, so you can easily turn the post object items into a slider.
After adding the repeater field to the target View, change the 'Enable Slider' option to 'Splide v4' and press the Save button. It'll automatically change the field markup to incorporate the necessary classes, and add the default JS instance:
You can customize it according to your needs, using any available Splide options.