Support

Account

Home Forums Backend Issues (wp-admin) Post Object Field: Grey out parent posts

Solved

Post Object Field: Grey out parent posts

  • Hi there, sorry if this has been addressed already – can’t find anything through search.

    I have a Post Object field set up but I need to find a way so that, if a post in the list has children, that parent post will be greyed out and only it’s child posts are selectable. There doesn’t seem to be any different classes or attr’s applied to list items that are parent or child posts, so I’m guessing I’ll have to do it through an ACF filter somehow, if it’s even possible.

    Can anyone point me in the right direction? I’ve tried playing around with a couple of acf filters but can’t find anything that applies to my situation.

  • Hi @p_cameron

    I’m not sure how I would tackle this in a final product, but here are some ideas that I had while thinking about it… they aren’t perfect solutions, but may be worth exploring if you can’t find the proper filter. I looked at all the filters as well, and can’t see any that may suit the situation.

    However, you may be able to explore the select2_init here.

    Ideas:

    1) You could switch to a select, and dynamically populate it, settings some items to disabled (if they have children).

    2) You could use AJAX in the footer to query the same Posts you are presenting in your Post Object, and then loop through them, and dynamically disable items.

    Hope that helps get you moving along. Let me know how you went about it!

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Post Object Field: Grey out parent posts’ is closed to new replies.