cmb2-attached-posts icon indicating copy to clipboard operation
cmb2-attached-posts copied to clipboard

Min/max options

Open jancbeck opened this issue 7 years ago • 3 comments

Is there a way to limit or require the number of attached posts similar as the relationship field of ACF? I'm basically using this field in place of the post search field for the nicer UI but want the user to only select one post.

jancbeck avatar Jun 08 '18 12:06 jancbeck

Hi @jancbeck AFAIK the min/max functionality has not been implemented yet but please anybody feel free to correct me as I am also looking for this. I created a PR for the "max-items" functionality which is waiting to be merged. https://github.com/CMB2/cmb2-attached-posts/pull/52

mclaurent avatar Jun 21 '18 11:06 mclaurent

I tried @mclaurent 's solution and it doesn't work.

If I add the data attribute as prescribed in the example provided, this piece results in an undefined variable:

var maxItems = $input.data('max-items');

Fiorinol avatar Jul 02 '20 23:07 Fiorinol

I sadly don't have any sort of followup suggestion either.

tw2113 avatar Jul 03 '20 02:07 tw2113