As the title says, I'll explain in detail.
Currently, there's no support to place an edit page link into an elementor template without inserting the post content form into the page. Which I didn't want to do as I didn't want to use content templates as a solution.
After searching around, I found a way around the fix;
This is one of my previous tickets which explains the situation
https://toolset.com/forums/topic/edit-content-link-in-elementor-not-working/
However, I'll explain in detail here what I would do to create the edit link to an external form from an elementor page.
In this example I am going to use a website not related to this one.
1. Create a CPT for Players
2. Inside CRED 'Create a Player'
3. Inside CRED 'Edit a Player'
4. Create a page and edit with elementor to show my CRED 'Create a Player' Form.
5. Insert a function into my Custom code area of Toolset and click activate.
function func_display_partner_edit_form() {
if(isset($_GET['partner_id'])){
return do_shortcode("[cred_form form='edit-user-profile' post='".$_GET['partner_id']."']");
}else{
return "To edit your Player profile, please select from the above link(s).";
}
}
add_shortcode('display_partner_edit_form', 'func_display_partner_edit_form');
This code links the views to the form.
6.Next I want to create 2 new views.
a) Create a view for the Player page, to show an edit link; (View Name: Player page edit link)
I will untick "Don't include current page in query result"
(we want to include the current page, because if we don't the link won't show for the current page)
This will have 2 filters;
Filter 1: Select posts with the author the same as the current logged in user.
(This will only show the edit link on the Player page to the current logged in user who is the author of the page)
Filter 2: Include only posts with IDs set by the View shortcode attribute "ids" eg. [wpv-view name="view-name" ids="1"]
(This will show just 1 edit link, which is related to the page it is currently on)
(Without this filter, edit links for all Player pages, would show on the Player page, that the author owns)
The code for this would be;
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop >
<center>
<a href="/edit-your-profile/?partner_id=[wpv-post-id]">Edit Your Profile</a></center>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"][/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
b) Create a view for the external page, hosting the form (to show above the form, for ease of access to all currently authored posts.)
(View Name: Dashboard edit link)
In this case, it doesn't matter if we tick "Don't include current page in query result", because we aren't looking to edit this page, where the view will be shown.
I will only filter by 1 item here;
Filter 1: Filter 1: Select posts with the author the same as the current logged in user.
(This will all links the author owns as we have not selected the second filter as we did earlier)
The code for this;
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop >
<center>
<a href="/edit-your-profile/?partner_id=[wpv-post-id]">Edit Your Profile [wpv-post-title]</a></center>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"][/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
7. With the above now, I can insert the edit link into the player page using the following shortcode.
[wpv-conditional if="( '[wpv-post-author format='meta' meta='ID']' eq '[wpv-current-user info='id']' )"][wpv-view name="edit-player-view" ids='[wpv-post-id]'][/wpv-conditional]
Notice the above works with the filters to produce a single edit link for the page that we're (the author is) on.
8. On my external page(Dashboard); (Creating and showing the Edit Player Profile form)
a) I will insert a heading - "Edit your Player Profile"
b) Insert the view "Dashboard edit link"
c) Add the following shortcode;
<center>[display_partner_edit_form]</center>
(When a link is clicked, this will open the form on this page.)
If we've done this correctly, everything should be set up to edit a player page from both the player page itself and the dashboard which we created for players ease of use.
Now to the main point of this ticket.
I have Created 2 CPT.
1. Parks
2. Caravans Stock
I have created a relationship between both CPT with a 1 to Many. (Park(1) to Caravan Stock(*))
I want to insert a link from the Park page, to allow people to submit a new stock entry onto a park.
I have tried to follow this article;
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/#creating-forms-when-a-parent-post-is-preselected
This would mean I need to use a content template, rather than showing my form within elementor.
Using the example above, the way around the edit post links with Elementor, would I be able to do something similar for the Add Caravan Stock to Park link?
I am sorry if this is very long winded.