Skip Navigation

[Resolved] Editing Post with Toolset Form without showing all post data around the Form (edit post on a separate page)

This thread is resolved. Here is a description of the problem and solution.

Problem:
I want to have a Post Edit Form on the Front End that lets users edit a post of their choice (usually, there will be a link on a single post saying "Edit this post" and if clicked, it'll lead to the Post Edit Form).
The Form, however, should be on a page, and only the form should be seen, no other post data around it.
I can hence not insert the Edit Form in the Post itself, or link to it the classic Toolset way, as that would show the Form within the single Post.

Solution:
You can do this by altering the ShortCodes of Toolset Forms when inserting them.

1. Head into a Content Template or any backend text editor and insert the Edit Form you created - using the Toolset "Forms" Toolbar Button. You will set the Form to edit a specific Post when inserting this ShortCode. Pass any Post you want, it does not matter just yet which post it is, important is to tell the form to edit a specific post.
You will receive a ShortCode like this:
[cred_form form='edit-vendor-listing-post-form' post='1369']

2. Now, replace 1369 (which is the post ID of any random post we selected to edit in the Form's ShortCode), with the URL parameter ShortCode that Toolset offers in the "Fields and Views" Toolbar Button: [wpv-search-term param="your_term"]
"your_term" here is any term of your choice, that you will later use to tell the Form what post to edit.
You will remain with something like this:
[cred_form form='edit-vendor-listing-post-form' post='[wpv-search-term param="your_term"]']

3. This ShortCode can now be inserted in the Page where you want this Form to edit posts.

4. In the single post template or any loop of posts, you can now insert a Custom HTML Link that links to the above-created page, with the form.
The HTML link should look similar to this:
Edit This Post

5. This will now create a Link, which leads to our page (page-with-edit-form) where the Edit Form is, and it passes the Post ID to edit in the URL parameter your_term. This Parameter is dynamically populated with the Post ID you currently see.

6. Hence, now you can head to any post or view loop (in the front end) where you inserted that link, click on "Edit This Post", this will lead you to some URL like https://site.com/page-with-edit-form/?your_term=1369, which is the Page with the Form that lets you edit that post (1369)

This support ticket is created 4 years, 10 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 12 replies, has 2 voices.

Last updated by mindyB 4 years, 10 months ago.

Assisted by: Beda.

Author
Posts
#1269803
Screenshot 2019-06-15 07.47.18.png

Tell us what you are trying to do?

I set up an Elementor template which arranges the Post Title, Content Title, featured image, and custom fields. It looks good. Then I added in the Edit Vendor listing link (to the content template which allows editing). However, when I go to edit the content by clicking on this link, which does load the content template, it is positioned in odd places. I would like it to simply go directly to the edit form and not include or be mixed in with the Elementor template. I can't figure out how to do this. Or at the very least add the edit content link on the bottom or top of the page and not within the Elementor template. Ideas?

In the image below you can see the "Edit Vendor Listing" and the form (both within the content template) appearing within the Elementor template. Again, I would like it not be inside, but either above, below, or on a new page.

Thanks, Mindy

#1269817

I understand you refer to a Toolset Post Edit Form which you link to from a single Post template, created with Elementor.

The Edit part of the Form will usually be placed to a Content Template as you did already, and in this case, this content template will replace the entire Post Body, but nothing else, of the Elementor, styled Single Post.
In fact, one could say the Form uses the single template, and replaces the content (post body) - so instead of the content you see the form, but as well still the title, and every other element around it

To avoid that you could create a Page, that has a Form in it and pass a ShortCode attribute to listen to another ID of post to edit (you can set that when inserting the form - instead of editing the current post you will want to edit another post.
This will produce [cred_form form="fdas" post="1"], where you can replace the 1 with for example a URL paramater coming from [wpv-search-term param="your_term"]

So later, you can create a Custom HTML link in your Elementor Template, which links to the page where you inserted this edit form, and passes the ID of the Post to edit as URL parameter ?your_term.

Such a link looks like <a href="site.com/page_with_form/?your_term=[wpv-post-id]">Link text to Edit Form</a>
The Form then inserted like this to a page:
[cred_form form="fdas" post="[wpv-search-term param='your_term']"]

That should then lead from the single post' edit link to the page with the correct post set in the form to edit.

This is the only way how you could have removed all "around" of the single post template.

#1272001
Screenshot 2019-06-18 16.36.48.png

I can't add any coding in the page, when I select edit another post.
So I can't do this step: post you will want to edit another post.
This will produce [cred_form form="fdas" post="1"], where you can replace the 1 with for example a URL paramater coming from [wpv-search-term param="your_term"]

#1272367

I see the setting to choose another form on your screenshot, so that's where you'd choose to edit another post with the Elementor Forms Widget. But, you cannot use the Elementor Forms Widget to do what I described here as you point out, there is no code editing.
https://toolset.com/forums/topic/editing-an-elementor-template/#post-1269817

Hence, you can use some text block or similar to insert the Form as ShortCode passing the URL parameter as Post ID.
The Elementor Widget will not produce a ShortCode you can edit, so to have a possibility to add anything else but a hardcoded Post ID to the Elementor Widget's input you'd have to ask at @ https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/ to add this, as this would be a new feature request.

But you can do it by simply inserting the ShortCode, eventually, you want to generate it elsewhere in an editor and then copy it over to the Elementor Template in a Text Editor.

This should then allow you to edit the post as given by the URL parameter you would pass as seen in my previous reply.

#1272505

I just submitted a support ticket to Elementor based on my initial inquiry above.

But in trying to work this out, I get close, but not quite. I went to generate a 2nd child elementor template of vendor, but don't know how to refer to the "passing the URL parameter as Post ID." I think this means when you link from vendor to the edit vendor, with both being elementor templates, --- how does the edit one know the vendor you're currently working on....

This is the code when you edit directly in the vendor display: not sure how to use it in the "child of the vendor" which is the edit page for the vendor.

[toolset-edit-post-link content_template_slug='edit-vendor-listing-content-template' target='self']Edit %%POST_TITLE%%[/toolset-edit-post-link]

????? Ideas simply, explaining how to pass the URL parameter as Post ID - ???
(Will also wait on Elementor)

#1272559

I apologise - the feature should be requested here https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/ - I updated my last reply after sending it in the hopes you had not yet read it but I seem to have been too slow.

I explained how to pass and listen to the URL parameter here:
https://toolset.com/forums/topic/editing-an-elementor-template/#post-1269817

You will:
- create a Custom HTML link that links to the page with the Edit Form and passes the ?url_param=xy of your choice.
You would add ?url_param=xy a the end of the link you create, so it passes the url_param to the URL.
site.com/sample-page/?url_param=xy

As explained earlier this would, in a loop of posts or on a single post, look like this:
<a href="site.com/page_with_form/?your_term=[wpv-post-id]">Link text to Edit Form</a>

You would not insert this with the edit link but with the Custom HTML link, as mentioned.

[wpv-post-id] has the post id of the currently seen post whether in a loop or single template so if you use that in your link the link will lead to your form by passing the url parameter, to which you can later listen in the form with [wpv-search-term param="your_term"]

This is explained here:
https://toolset.com/forums/topic/editing-an-elementor-template/#post-1269817
You cannot use the ShortCode edit link or the Edit Form Widget of Elementor but must use Custom HTML href link and ShortCode of the Form.

#1272969

there is too much coding... with this method...
how do you edit a posted listing without coding?

#1273237

With widgets of Elementor it won't allow passing a URL parameter, I think.

Can you share access to the site and allow me to set up an example for you?
Maybe you can then re-use it as an example!

I'm off today so I could set up this example tomorrow if you could meanwhile provide the access and allow me to do this?
(Or I can show this on an online site of ours, if you prefer, please let me know).

#1274857

I've used this Post Form hidden link in my example.
The Form edits Vendors. I understand you want a link from the single Vendor Post to its edit form. You want this Form to "take over" when seen, not bein nested within the Post Title, and other non-content parts of the post.

For that as mentioned you'd need to insert the Form in a Page which you style adequately do show only that Post Form and the other data, you want to show.
I created such page here (with Elementor, as I assume, you'll later design it anyway with the Builder)
hidden link
In here, classically you'd be adding the Forms Widget, but as you already mentioned, while you can choose to edit another post, you have (due to any Page Builders nature, which is to hide the code) no chance to edit this Post ID to be dynamic.
You could submit a Feature Request at https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/ to add dynamic input there (by URL parameter). That would be a generally good feature for Toolset Forms, even without Elementor. I'll add it to my own list as well.

Now, back to the "how to", in that page editing with Elementor, we are going to insert the Form as a ShortCode, instead of using the Elementor Widget.
We add a simple text editor widget and insert the Form as ShortCode. To get the ShortCode, you'll need to head into a Content Template or any backend text editor and insert the Form - without Elementor. That'll give you a shortcode like below.

[cred_form form='edit-vendor-listing-post-form' post='1369']

Now, replace 1369 (which is the post ID of any random post we selected to edit in the Form's ShortCode), with the URL parameter ShortCode [wpv-search-term param="your_term"]

[cred_form form='edit-vendor-listing-post-form' post='[wpv-search-term param="your_term"]']

This ShortCode can now be inserted in the Page we created to edit posts, in the Text Widget
hidden link
Note, in the example, I changed the parameter for the search term to "post_id". You can change that, but you need to ensure it's the same as in the Link we are going to create next.

This link should be added the Template applied to the Vendors.
I created such a template here with Elementor: hidden link
Again we insert a Text Editor (or it could be a button where you can add the link, whatever you prefer) and create a simple Link where we pass the URL parameter "your_term" (in the example it's post_id):

<a href="<em><u>hidden link</u></em>;">Edit This Vendor</a>

This will now create a Link, which leads to our page where the Edit Form is, and it passes the Post ID to edit in the URL parameter post_id. This Parameter is dynamically populated with the Post ID you currently see.

Hence, now you can head to any vendor (hidden link as example), click on "Edit This Vendor", this will lead you to hidden link, which is the Form that lets you edit that post.
Note that nothing else is shown around the Form.

Note, I have drafted the Elementor template hidden link, you can enable it @ hidden link by publishing the "Vendor Template — Draft".

That should be a good example to achieve the goal you mentioned. It involves minimal "coding", only an HTML link needs to be "coded". All the rest can be designed as used in Elementor. You might even be able using their Button Module to create this links, I think.

#1276565

Getting there... I need to add in the relationship form between vendors and farmers markets...

there's a relationship form called "attendances" with a relationship form called "edit attendances" - how do I code for this...
been trying - see second line below.... (not getting code right - can I do this?)

[cred_form form='edit-vendor-listing-post-form' post='[wpv-search-term param="post_id"]']

[cred_form relationship-form='edit-attendances-relationship-form='[wpv-search-term param="post_id"]']

#1276569

see above comment and below:

P.S. Minesh worked with me to add code beiw for editing relationships using a view.
But with the idea of passing the post-id - I wondered if I can do the same for editing relationships...

Here is the code for editing, deleting,... and then I would need to add in the one for adding... as well

[wpv-post-link] === [cred-relationship-form-link form='edit-attendances-relationship-form' role_items='$fromViews' content_template_slug='edit-attendances']Edit [/cred-relationship-form-link] === [cred-delete-relationship role_items='$fromViews' relationship='attendance']Delete [/cred-delete-relationship]

#1277149

I am not sure what you try to achieve here:
https://toolset.com/forums/topic/editing-an-elementor-template/#post-1276565

Those are 2 different Forms, one creates or edits posts, and the editing part of this form can listen to a Post To edit (which we did in the previous exercise).
Relationship Forms either edit or create relationships, hence they connect posts, they do not create or edit posts themselves - this means they cannot listen to any Post ID to edit.
The ShortCode as you share it is also not valid:

[cred_form relationship-form='edit-attendances-relationship-form='[wpv-search-term param="post_id"]']

This would call a cred_form shortcode with relationship-form attribute, but then in that attribute, it has a second attribute "edit-attendances-relationship-form", populated by a Post ID - that can not work, WordPress ShortCodes do not have "nested" attributes in this format.

To a relationship form, the selectors to connect the posts can only be filtered by the current users' posts or altered in their ordering, see Toolset > Relationship Forms > New > Form Editor > the fields for the related posts selectors.
So these Fields only listen to an "author" parameter, which you may use to pre-populate those fields, but it won't allow to populate them by Post ID.
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred-relationship-role

When inserting Relationship Forms, you can choose what posts to connect.
You can choose to connect between any post, between a given post and any post (both sides), and if the relationship has fields you can edit those.
It produces shortcodes like these:

[cred-relationship-form form="igz" parent_item="2"]

As you can see there is no "'edit-attendances-relationship-form='[wpv-search-term param="post_id"]'" attribute - there is only the parent_item/child_item (post id) if one end is set when inserting this form.
You can use both together, passing the ID of related posts like this:

[cred-relationship-form form="igz" parent_item="2" child_item="1"]

This would show the front end form to connect posts already populated with both related posts ID 1 and 2.
The ID here, of course, you can again replace with a [wpv-search-term param="your_term"], which returns precisely the ID you want to be selected in the Relationship Form.

Now, linking from a single post to an Edit form of that post is one thing, linking from a single post to its possible relationships is another thing.
Here, you will have potentially many posts that are linked.
So you would need a View listing all linked posts to this single post.
Then, in that View, you could insert a Form that lets you edit that relationship, for example.
You'd not need to pass an ID, as the View would already set the form to edit the right relationship in the loop and you could manually choose the connection to the other end.
However this is another topic, it's not related to editing a single post in a Toolset form without showing other post content.
This would be done in a View, which can then be inserted to the single posts for example.

I suggest opening a new ticket if this issue remains about editing or adding relationships, as the approaches vary from what you do to edit or add single posts.

#1277971

My issue is resolved now. Thank you!

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