I have one custom post type with some custom fields.
Some of this can be visible by everybody on my website.
And some of this can be visible only for people who have a unique key to access to it.
This unique key is defined by the admin in a text custom field.
The idea is to have a form in my footer, and when an user puts the unique key, he can access to the custom post type and view the public and private content.
So I think the main idea is when the user submit the form,
we have a loop through every post type, looking for a match with the keygen custom field. If it’s ok, we display the post with all fields, if not the form says “not found”.
Someone have an idea ?
You can query the posts based on the custom field. This page should give you more idea about it: http://www.advancedcustomfields.com/resources/query-posts-custom-fields/.
I hope this helps.