Home › Toolset Professional Support › [Resolved] Adding an Edit Post form into My Account page, cannot insert shortcode
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 |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
This topic contains 11 replies, has 2 voices.
Last updated by WilliamM1564 2 years, 11 months ago.
Assisted by: Nigel.
Tell us what you are trying to do?
Trying to insert short code for Content Template with Edit Advisor form into Content View in My Account page. I cannot activate the button to insert shortcode. I do not know what I may be doing wrong.
Is there any documentation that you are following?
Yes, I am in Course on WordPress Directories and Classified Listings, Chapter 11.3
https://toolset.com/lesson-placement/lesson-placements-1622969-1655453/
Is there a similar example that we can see?
hidden link
Of course it does not yet have the Edit Listing links I am trying to create.
What is the link to your site?
hidden link
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Does the Content Template you selected contain a Form?
If it does, then selecting it should unlock the Insert Shortcode button.
Can you check your browser console for JS errors to see if there is a problem on the page that prevents the relevant code from running?
Let us know what you find.
Yes, it does contain a form. That's all that it contains.
As to JS errors, I opened the JS console while I once again inserted a Fields and Text Block, clicked Add Form, clicked Edit Post Link and brought up the window in the screen capture I shared earlier in this thread.
From there there is not much to do, I selected "Edit Advisor Listing" (the only one presented as I think it is the only one with containing an Edit Form) and the "Insert Shortcode" button remains greyed out.
During this time there were no JS errors or messages displayed.
Is that what you meant me to do when you said "Can you check your browser console for JS errors to see if there is a problem on the page that prevents the relevant code from running?"
Now there are other errors in the Javascript panel that seem to be related to Toolset but I do not know how long they have been there (see attached screenshot). Ignore "HOLD THIS" that was just me trying to mark the place in the console before I tried to add the link.
I am not sure what to try next.
Thank you so much
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
OK, that shows a 500 error on one of the server requests, which means that when the browser sent a request to the server for an update a fatal error occurred on the server, which was unable to complete the request.
So, details of that error will be in the server PHP logs.
If you haven't already, turn on the debug log by editing your wp-config.php file and change the line with WP_DEBUG like so:
define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false); define('WP_DISABLE_FATAL_ERROR_HANDLER',true);
That will create a debug.log file in your /wp-content/ directory which you can examine in any text editor. Try going through the same steps to insert the link to the form and then inspect the log and share the results, please.
OK. Definitely unexpected results.
1. I made the changes to wp-config.php
/** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. */ define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false); define('WP_DISABLE_FATAL_ERROR_HANDLER',true);
2. No debug file seems to have appeared. However, bizarrely, when I repeated the attempt to add the content template it did add a a link!
3. The link does not edit the listing, it just displays the listing.
hidden link
I am not even sure what just happened, let alone what to do next to resolve the matter!
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Can we get access to your site and try to set this up for you (and see what fails along the way, if it does)?
Let me mark your next reply as private so that we can get log-in credentials from you—you may want to create a temporary admin user for us to use that you can later delete. And be sure to have a current backup of your site.
To confirm, you are trying to insert a link to the edit form (found in the Edit Advisor Listing template), and you are trying to insert that link into the my-account page, yes? Where in the my-account page? Is there a View that lists the posts of the kind you want to edit?
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
OK, a few observations before I get to what I think the issue is.
I noticed that the template you created to hold the edit form was also assigned to the Advisor post type. That's not right, it means you are trying to use this template to display Advisor posts, and it doesn't output the post content, it displays an edit form, so I unassigned the template.
I couldn't test the issue readily as my user has no listings to display on the My Account page (or to edit). So I edited the William Galileo advisor post and set Toolset Support as the author. The required email field was empty, so I entered a dummy email address in the profile to be able to save the post with the updated author.
Now I could see the listing on the My Account page to test it.
The Edit Listing link I can see is correctly formed, so what you've done so far is correct and working.
Where it fails is that—I'm guessing—you are using Divi templates to display the Advisor post type, but you are not outputting the post content anywhere in that template.
Toolset templates replace the post content. Ordinarily a theme would have a PHP template for single posts that output the post body (the post content) using the_content function. Toolset filters what is output by the_content function and replaces it with the content from your Toolset template. (That is also how edit forms which live inside a template work.)
So you don't see the Edit Form because the post content isn't displayed anywhere.
I'm not entirely sure, but I expect that if you edit the Divi template for single Advisor posts and include the post content, then that specific part of the template will be replaced by the edit form when following the link to edit the listing. (You could add the post content at the top of the Divi template; if advisor posts have no content then ordinarily nothing will be output, and only when following the Edit Listing link will the edit form appear there.)
Sorry, Nigel. I am confused when you say I do not output the post content anywhere on that template. Isn't that what the whole page is?
Or do you mean I actually need to display a Content Template defined in Toolset? The post content is currently all pulled from Toolset through Divi directly by field. There are some Content Templates within the Divi template (e.g. the Chat and Call buttons) but the whole thing is not in a big Content Template.
hidden link
Thank you so much
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
When you visit an advisor post on the front end it outputs plenty of content, but not the post content (your advisor posts don't have any post content, all of the "content" is from custom fields, see the screenshot).
What's show on the front end is coming from somewhere, and that somewhere is a custom template you have made with the Divi theme builder. There are no Toolset templates involved in the display of advisor posts.
I haven't edited your Divi template, but it seems that it doesn't include a module to output the post content (or "post body"), because if it did that's what the edit form template would hook into to insert the edit form, which isn't being shown.
If you are using Divi templates for advisor posts and you want to be able to use a Toolset Form to edit advisor posts you'll need to make sure that the Divi template outputs the post body where you want the edit form to appear. (It's not possible in this set-up for the edit form to completely replace what is output by the Divi template, we don't have control over that.)
An alternative would be to not use Divi templates for the output of advisor posts, and instead use a Toolset template.
Oh you mean the "body" content of the Advisor post! Yeah, I haven't used that field at all because it is a WYSIWYG field right? I don't want my Advisors being able to do any of their own formatting of any part of their Advisor listing.
I could conceivably use that as one of the multi-line text fields (e.g. Background) but I would want to hide the formatting tools when it was edited on the front end. Is that possible?
But if I understand what you are saying correctly, the whole profile would not be replace with the form, just the "body" content field (if I continue to use a Divi template). That would look weird.
I am not certain I am ready to make this shift, but if I used a Toolset Content Template instead of a Divi Template to display Advisors, would the whole Toolset template be replaced by the Edit form? Or would it still just replace the "body" content / field and have all the custom fields still displayed outside it?
Thank you so much for your patience. It took me a bit to understand what you were talking about.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Your understanding is correct, yes.
With the Divi template, the form would appear where the post body module was inserted (and which would normally show nothing).
If you used a Toolset template the whole advisor post content would be replaced by the form.
If you care comfortable with some coding you could check with Divi if they have an API filter where you could intervene when loading an advisor post if Toolset's content_template_id URL parameter is present and not use the normal template in that case and instead use a blank template which only outputs the post body (which is what Toolset would then replace with the form).
I am thinking this will probably mean I need to switch the Advisor template from Divi to Toolset. Not thrilled about that, but I will consider what will be the optimal solution.
I will open a new thread if and when I am ready to tackle that!
Thank you so much.
My issue is resolved now. Thank you!