Skip Navigation

[Gelöst] How can a edit CRED form shortcode in a page dynamically receive Post ID

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

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.

So you should have a setup like this.

[cred_form form="Edit Post" post="[wpv-search-term param='post']"]

The next thing is to have your edit form link to the page where the form is embedded so your setup should be similar to.

<a href="http://localhost:8888/layouts_demo/uncategorized/test/?post=[wpv-post-id]">

Relevant Documentation:

This support ticket is created vor 8 Jahre, 2 Monate. 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 5 Antworten, has 3 Stimmen.

Last updated by ahmedh vor 8 Jahre, 2 Monate.

Assisted by: Shane.

Author
Artikel
#362835

Hello,

From a VIEW loop I'm passing a query string parameter (Post ID)
<a href="hidden link;">EDIT</a>

to a page that has a CRED edit form with the form shortcode such as:
[cred-form form="Edit Post"]

Your documentation has only an example of hard-coded post ID:
[cred-form form="Edit Car" post="145"]

I can successfully get the url query string to display the post id for example: ?post=145

But how do I dynamically pass the parameter value into the form's shortcode so that this specific post (id=145) is edited?

#362860

Shane
Supporter

Languages: Englisch (English )

Timezone: America/Jamaica (GMT-05:00)

Screen Shot 2016-01-28 at 3.32.11 PM.png

Hi Allan,

Thank you for contacting our support forum.

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.

Please let me know if this helps.

Thanks,
Shane

#362942
[SCREENSHOT 3] The Wordpress PAGE with the embedded form shortcode.PNG
[SCREENSHOT 2]  The Form by itself with Sidebars.PNG
[SCREENSHOT 1]  The View Page with EDIT & DELETE links in Loop.PNG

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%"]

#363145

Shane
Supporter

Languages: Englisch (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Allan,

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.

So you should have a setup like this.

[cred_form form="Edit Post" post="[wpv-search-term param='post']"]

The next thing is to have your edit form link to the page where the form is embedded so your setup should be similar to.

<a href="<em><u>hidden link</u></em>">

Please let me know if this helps.

Thanks,
Shane

#363150

Exactly what I needed, and it worked like a charm.

Thanks a bunch Shane.

#576631

Hello,

I have a similar issue as I want to add an edit link into the single post that edits in a separate page that has a cred edit form.

Please help.

Thank you,

Ahmed

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