Skip Navigation

[Resolved] Front end form on different page

This support ticket is created 2 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 7 replies, has 3 voices.

Last updated by tomaszB-4 2 years, 6 months ago.

Assisted by: Waqar.

Author
Posts
#2201337

Hello!

According to the instructions, I prepared the post editing:
https://toolset.com/course-lesson/front-end-forms-for-editing-content/

It's work fine but I need to display editing form on different layout. So I need to put it on another page. Right now this is the same page for post and for its edit.
How can I achieve this?

Maybe there is an instruction somewhere?
But I did a lot of research, and only found some forum posts. But they related to the old Views plugin. I can't use it in this new solution with blocks.
Thanks for every tip!
Tomasz

#2201613

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

The normal way of using forms to edit posts involves displaying the edit form at the same URL as when displaying the post itself (but the form is displayed instead of the post, triggered by a URL parameter to switch what is displayed). It's an either/or scenario, where you see the post or the edit form, not both (except that can happen when creating templates via page builders like Elementor).

If you want to display the edit form somewhere else you can do that as long as the context is the post you want to edit.

That context is automatically set when visiting the post on the front end. An alternative is to add the edit form to the output of a View that is displaying the post(s).

Is that an option?

Or how do you intend to link to the page displaying the edit form?

#2201831

Nigel wrote the answer. Strange thing, because I can't see the content of Nigel's email here. Therefore, I am pasting what I received in the email below.

I will also write my answer right away:
I would like to embed the edit form on a different page than the post. And I would like to add link to this page in the post.
So I create on this other page View. I embed the edit form in it. But I don't know what to do next.

edit:
oh! After posting my reply, Nigel's post appeared so I'm removing it from here.

#2202385

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

Nigel shared the view option in general and it is applicable only for cases where a page is already showing some posts, using a post view.

You need to place the edit form on a different page, which doesn't already include a view, so you can follow these steps:

1. In your actual post page, you'll need to include the edit link for the separate page with the edit form, like this:


<a href="[wpv-post-url item='12345']?target-id=[wpv-post-id]">Edit this post</a>

Note: Please replace "12345", with the actual ID of the page that you want to use for the edit form. As a result, when a visitor will click this link, he/she will be taken to the edit form page, with the target post's ID passed in the URL parameter "target-id".

2. On the edit form page, you can include the edit form's shortcode, like this:


[cred_form form='form-to-edit-post' post='[wpv-search-term param="target-id"]']

Note: Please replace "form-to-edit-post" with the actual slug of your edit form.

The post='[wpv-search-term param="target-id"]' part will tell the form to get the ID of the target post, from the URL and use that for editing.

Tip: You can wrap the form's shortcode inside the condition, so that when a target post ID is available in the URL parameter, the edit form is shown, and when not, a warning message "No target post ID provided!" is displayed:


[wpv-conditional if="( '[wpv-search-term param="target-id"]' ne '' )" ]
[cred_form form='form-to-edit-post' post='[wpv-search-term param="target-id"]']
[/wpv-conditional]

[wpv-conditional if="( '[wpv-search-term param="target-id"]' eq '' )" ]
No target post ID provided!
[/wpv-conditional]

#2202997

Thanks Waqar!
Thanks for the detailed description and for precise explanation!

I did exactly according to yours guidelines,
and checked 3 times but it doesn't work.

Such message appears:
Form type and post type do not match

Previously, it worked with the same form, but according to the procedure for replacing the form with the content.
I think it's not about differences in type.

To be sure, I checked for the 4th time [really 4th time :)] preparing the description below.

In the post template I have:
<a href="[wpv-post-url item='216']?target-id=[wpv-post-id]">Edytuj</a>

216 is the ID of the page with the edit form

On page with ID 216 there is:
[cred_form form='edytuj-wpis' post='[wpv-search-term param="target-id"]']

'edytuj-wpis' is slug edit posts form.

I don't like to bother people, but I have no way, so I am asking for further help.

#2205977

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

The steps that you've shared seem correct and it is strange that the form is not working.

For the edit form to work the post ID that gets passed in the URL attribute "target-id", needs to be from the same post type that the form is set to edit.

If the issue still persists, please share temporary admin login details, along with the link to the page where this edit post link can be seen.

Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.

#2207967

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing the admin access.

I noticed that your website is set to use the default permalink structure ( e.g. {yourwebsite.com}/?p=123 ) and not the pretty permalinks ( {yourwebsite.com}/post-name ). This explains why my proposed solution didn't work, when you added the edit form on a page.

You can read more about the WordPress permalinks from this guide:
https://wordpress.org/support/article/using-permalinks/

Please go to WP Admin -> Settings -> Permalinks and change it to the "Post name" from "Plain".

After that, the edit form should work from within a page. In case, you experience any issues, please share the link to the page, where you've added the edit form.

#2208039

Thank you Waqar for checking!
This website will be only work on the local network. No one from the outside will have access. And I'm afraid there won't be modrewrite there.
So probably only the standard solution will remain.
Anyway, thank you very much for your support!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.