[Résolu] How can a edit CRED form shortcode in a page dynamically receive Post ID
Ce fil est résolu. Voici une description du problème et la solution proposée.
Problem:
The problem is that the customer had a CRED Edit form embedded on a separate page and wanted to use that page to edit all his posts.
Solution:
I managed to get this to work on my end, so what is needed is for you to follow the steps below.
First you need a way for the edit form shortcode to get the id of the post to edit from the url. To get this you will need to use the [wpv-search-term] shortcode.
This support ticket is created Il y a 8 années et 3 mois. 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.
From your post I gather that you want to place an edit post link beside each post in the view loop correct?
If so then when you click the CRED Forms button you will be presented with a popup like the one in my screenshot.
All you need to do is select the options that I have and the shortcode will generate a link for the post being displayed in the current loop, so you do not need to pass the ID of the post manually.
Hi Shane, what I meant was that the loop/grid [SCREENSHOT 1] will have an edit link to a new PAGE that has the CRED edit form embedded as a shortcode [SCREENSHOT 3] , NOT A LINK TO THE FORM ITSELF in a new window [SCREENSHOT 2].
As you notice in screenshot 2 (the form window) you get these two left and right sidebars. Whereby in screenshot 3 (the page window) I have made the Page Attributes > Template as "Full-width" to be consistent with the rest of the CMS interface. In the form window the left sidebar displays post author meta which is totally unnecessary, irrelevant and confusing to the user.
Like I mentioned in my first message I know how I can SEND a querysting from the edit link in the view by using an href anchor hidden link; from the view's loop.
What I want to know is what can be done on the receiving end, that is the PAGE that has the embedded shortcode for the edit form. How can I dynamically pass the querysting URL parameter (?post-id=1234) from the previous page into the form shortcode to be placed in the post id parameter of the form's shortcode?
This [cred-form form="Edit Car" post="145"] -----> becomes -------->
Something to that effect: [cred-form form="Edit Car" post="%post-id%"]
Thank you for the clear explanation.
I managed to get this to work on my end, so what is needed is for you to follow the steps below.
First you need a way for the edit form shortcode to get the id of the post to edit from the url. To get this you will need to use the [wpv-search-term] shortcode.