Home Forums Front-end Issues Form Instructions


Form Instructions

  • The file given in the example could be code in a template in the WP template hierarchy, or it could be a WP custom page template.

    It really depends on where you want the front end form to appear. You could place this on in the custom template that would be used for your event archive page, example archive-event.php and then on the page where the list of events is located someone could create a new event.

    Or like I said above, it could be on a “Page” dedicated to the form in this case you would create a custom template. The new post would be created by the the form and added to events instead of page. In this case you would also want to see information on the acf/pre_save_post filter for information on how to set the post type of the post being created.

    Hope this helps, if you need more specific answers on the documentation let me know where you’re having difficulty and I’ll try to help.

  • I’ll try to be more specific πŸ™‚ I understand there are options, but let give one example of how I might want to do this. Again bear with me if this seems very basic.

    The slug for my CPT is “directory”.

    Say I wanted to have an dedicated individual directly related to the CPT. I don’t want an ‘archive’ page. I want a page that could potentially have all the other stuff, (sidebars etc.) as I presume, a template page, but the ‘content’ of the page would be the submission form. I would want to load the page from a menu item.

    As I look at the template hierarchy, I don’t want to name it archive-{slug} – right – because that is a different functionality and one that I would want to use the archive functionality for “that” purpose πŸ™‚

    So I am confused as to where in the the template hierarchy the name I want to use fits?

    Thank you for your patience and help.

  • What needs clarification in documentation (and I think understand it now but why I was thrown off course):

    There doesn’t seem to be a way for a custom page for things unless you make a custom page template file, then create a new page using the custom template file? If I use archive-{slug} for example to display a form, then I don’t have an archive listing for that post type. That doesn’t work out very well πŸ™‚

    I have some study time in Laravel where routes are used. It seems the “Template Hierarchy” is a very controlled way of getting around using routes.

    PLEASE tell me if I am missing something and if I can do this, have a custom page for say a form, without having to create a custom template and a page for it. Display that from a menu item etc.

  • You are correct. You would need to create a custom page template and then use that custom page template to create the page to display the form.

  • John, thanks for the clarification.

    For anyone following this, this idea came back from ACF support request:

    If you have named your file “page-new-post.php” then all you have to do is create a new page titled “New post” with the slug “new-post” so that the template file is used for the page.

    It was not apparent to me initially, (maybe I didn’t think this way when I read things), that this was a good way to go. I imagine if you had a very long title it might be cumbersome?

    If you have any comments or considerations on this John, please do so πŸ™‚

  • Oh, yes, you can create a page template in the template hierarchy that will be used for only one specific post. I had completely forgotten about this, mostly because it is very rare to do this.

    For example I could create a page titled Custom Form Page

    The slug for this page would be something like custom-form-page

    I can then create a custom template and name that file page-custom-form-page.php

    WP will use this template to display the page and this is the only page that will use this template.

    The same can be done for posts and even custom post types.

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

The topic ‘Form Instructions’ is closed to new replies.