-
Notifications
You must be signed in to change notification settings - Fork 8
PostRelationshipControl
This component is used to select related posts in a block. It inherits BaseControl
.
import { PostRelationshipControl } = gumponents.components;
<PostRelationshipControl
label="Select people"
help="Select people"
postTypes="people"
taxonomies={ [ { people_roles: [ 'ceo', 'management' ] } ] }
value={ people.map( person => person.ID ) }
onSelect={ people => setAttributes( { people } ) }
buttonLabel="Select People"
filter="people_meta"
max="1"
/>
The label for the control.
- Type:
String
- Required: No
The help text for the control.
- Type:
String
- Required: No
Post type(s) to query for.
- Type:
String
|Array
- Required: No
- Default: "post"
Taxonomies to filter, used in addition to post types above.
- Type:
String
|Array
- Required: No
The label for the select button.
- Type:
String
- Required: No
The selected post IDs for this control.
- Type:
Array
- Required: Yes
A function that receives the values of the control.
- Type:
Function
- Required: Yes
Creates a custom filter name which can be used to further customize results. More below.
- Type:
String
- Required: No
The maximum number of selections that can be made with this control.
- Type:
Number
- Required: No
This filter is used to query the WP_Query
args before they are executed for this control.
If the filter
property is used, then that gets appended to this, to create a custom filter name. For example if the value of the filter
property was people_meta
, the available filter would be gumponents_posts_relationship_query_people_meta
This filter is used to turn searching the title on or off.
This filter is used to customize results before they are passed on to this control.
If the filter
property is used, then that gets appended to this, to create a custom filter name. For example if the value of the filter
property was people_meta
, the available filter would be gumponents_posts_relationship_results_people_meta