• Hi,

    I used the CPT UI and ACF plugins to create custom fields for a new custom post type called “person”. A person has a long list of custom fields from different types, such as text, dates, photos, links to other persons, etc.

    I am using a form (created with the acf_form function) for adding a new person and for editing an existing person from the frontend.

    I would like to create another frontend page for showing the information of a specific person – just displaying it without letting the user to change anything.

    What is the recommended way to do this ?

    Since there are multiple custom fields for a person, it might require a lot of coding to build a page template that displays all the information in a nice design with tabs, rows, field grouping, etc.

    I thought of perhaps creating a form to hold the data of a person, pre-populating it with the relevant data of the specific person upon load and showing it in a “read only” mode, however could not find any form plugin that will allow me to do so.

    Thanks in advance,

    Amir.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m unfamiliar with acf_form(). Does it have a filter or some way of altering the output? You could conditionally remove the submit button to make it “read only”. While the user could still edit the fields, they cannot submit it to effect permanent change. Even so, the form handling script should not accept submissions from users without proper capability, since a bad actor could still manage to submit the form without a submit button. If you cannot answer these questions and wish to pursue this approach, I suggest you inquire at the dedicated ACF support forum. They are in a better position to help you with altering their form function’s output.

    That said, I think a custom page template solution that presents the data in a nice format without distracting form elements would be preferable. Yes, it’s tedious to code for all those fields, but it only needs to be done once. You might be able to shortcut much of this by querying for all the fields all at once, then running a foreach loop to output each returned field key and value in turn.

    Thread Starter ivitae

    (@ivitae)

    Thanks for the reply !

    I sent a question to ACF support, but as far as I understand acf_form cannot create a “read only” form – so the only other option I am aware of is indeed creating a custom page template with dedicated code for this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying custom post type on the frontend’ is closed to new replies.