Home Forums General Issues Hide/Show Protected Content on a post


Hide/Show Protected Content on a post

  • Hi guys,
    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 ?

  • Hi @damien

    You can query the posts based on the custom field. This page should give you more idea about it:

    I hope this helps.

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

The topic ‘Hide/Show Protected Content on a post’ is closed to new replies.