Tell us what you are trying to do?
I can't set a default Content Template on a custom post type
Is there any documentation that you are following?
No
Is there a similar example that we can see?
hidden link
What is the link to your site?
hidden link
When I create a post on wordpress from the back o frontend I can't see the content if II don't select the content template from the Gutenmberg Editor.
Hi,
Thank you for contacting us and I'd be happy to assist.
Can you please go to WP Admin -> Toolset -> Content Templates and see if any content template has been assigned to this custom post type?
If not, you can use the change usage link to assign it, from the action bar that shows when you'll hover over the template's title.
( screenshot: hidden link )
In case the issue still persists, you're welcome to share temporary admin login details in reply to this message.
Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.
regards,
Waqar
Thank you for sharing the admin access.
I've noticed that WordPress and a number of plugins including the Toolset ones are not updated to their latest versions.
To troubleshoot this, I'll suggest the following steps:
1. Please make sure that WordPress, active theme, and plugins are all updated to the latest versions.
2. It would be interesting to test this with all non-Toolset plugins disabled and a default theme like Twenty Twenty-One.
If it's fixed, you can start adding the disabled items, one-by-one, to narrow down to a possible conflicting one.
3. In case the issue still persists, I'll need your permission to download a clone/snapshot of the website, to investigate this on a different server. This way your actual website won't be affected.
( ref: https://toolset.com/faq/provide-supporters-copy-site/ )
Please let me know how it goes.
I don't see the content with another theme
I'm trying to add this javascript code on the post form to add the shortcode:
<script type="text/javascript">
document.getElementById("cred_form_97499_1-submit-1-1613548904").addEventListener('click', function () {
var text = document.getElementById('[wpv-post-body view_template="journalist-identikit"]');
text.value += ' after clicking';
});
</script>
but I don't see the results on frontend
Thanks for writing back.
I see that the Toolset plugins are updated to the latest versions, but WordPress is still an older version. I'll recommend updating it to the latest version too.
I've checked a couple of "Journalist" posts and the content template "Journalist Identikit" seems to be showing correctly.
I'm also not sure exactly what you expected from the custom script, since shortcodes can't be inserted through the scripts. If you could share more details about this requirement, I'll be in a better position to suggest a better approach.
My problem is on creation of the Journalists single posts. I'm using the cred post from the frontend and this kind of creation post doesn't consent me to set the journalist content template. I'm looking for some workaround to insert the shortcode automatically because Toolset don't set this kind of content template for any journlist-posts.
Anybody can help me on this topic?
Thank you for waiting and I apologize for the delay in getting back on this.
I've performed some tests on my website with a new post form and the assigned content template is automatically applied to the new posts created using the front-end form. No extra workaround or script is needed for that.
Next, I removed the following script from your website's form "Add Journalist", and used it from the page "The Journalists", to submit a test entry "Test entry from TS support":
<script type="text/javascript">
document.getElementById("cred_form_97499_1-submit-1-1613548904").addEventListener('click', function () {
var text = document.getElementById('[wpv-post-body view_template="journalist-identikit"]');
text.value += ' after clicking';
});
</script>
If you'll check that new post in the admin area, you'll see that the designated template "Journalist Identikit" is automatically assigned to it, as expected.
Please feel free to test the form again and in case the issue still persists, please share the exact steps.
What you have tested is ok, but there is not any result on the frontend and I need to put manually the custom template content shortcode to see the results. I see the grey background when I aspect to see the custom fields.
Thank you for sharing these further details and I now understand what you mean.
A quick fix would be to use the "cred_save_data" hook to make the form, automatically insert the content template shortcode in the newly created post.
( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data )
For example:
add_action('cred_save_data','func_custom_post_content',10,2);
function func_custom_post_content($post_id,$form_data) {
if ($form_data['id']==97496) {
$args = array('ID' => $post_id, 'post_content' => '[wpv-post-body view_template="journalist-identikit"]');
wp_update_post($args);
}
}
The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.
To properly investigate why you're facing this issue in the first place, I'll need your permission to download a clone/snapshot of your website, to run some tests.
( ref: https://toolset.com/faq/provide-supporters-copy-site/ )
It is strange that this code worked on my test website, but not on yours.
Do I have your permission to download a clone/snapshot of your website?
You can do all the tests you need.
The ID of the post cred was wrong. Now I've updated with the right ID and it's ok, thank you so much for your assistance.