Support Forum
Support › MB Frontend Submission › Replacing WYSIWYG editor with medium editor?Resolved
Hi,
I want to use https://github.com/yabwe/medium-editor
If I put my own textarea in a form in html, it works ok.
But I want to use it to allow users to add posts from the front end using metabox frontend submissions.
Is there a simple way to do this? I see there is a WP plugin that does it for ACF Pro but I don't really want to buy that just for this unless I can avoid it.
Thanks
John
Hi John,
You can use the textarea
field to allow the users to use the medium editor on the frontend, remove the default post field content
in the frontend submission shortcode. Then follow this tutorial to update the post content by the textarea
content https://docs.metabox.io/save-wysiwyg-content-post-content/.
Or follow this documentation to use the custom field and save the data to the post content.
https://docs.metabox.io/extensions/mb-frontend-submission/#reorder-post-fields
Thanks Long!
I'm actually struggling at the moment as the theme I am using (Mediumish) has a conflict with Metabox Pro (using AIO) - "Cannot redeclare tgmpa()" - I wrote to them yesterday but not heard anything yet.
Currently progressing my work with Pro turned off but obviously not ideal.
Is there a particular plugin that could be causing this? I know it's no doubt their fault, but if it's just one particular plugin and I could install the rest without installing AIO that could be a solution for now.
Their theme comes with the lite version of Frontend Post Submission Manager and considering going Pro on that, only $18.
Thanks
John
I've managed to install quite a few of the standalone plugins so far, all that I think I need for now anyway. None of them contain this issue.
Hi Long,
Sorry, I've tried your first solution - https://docs.metabox.io/save-wysiwyg-content-post-content/ - but it's not working.
I'm not even trying to get the mediumeditor bit to work at the moment so I don't confuse things.
So on the frontend page I have this:
[mb_frontend_form post_fields="title"]
instead of
[mb_frontend_form post_fields="title,content"]
I've also tried
[mb_frontend_form post_fields="title,wysiwyg"]
as well as the original. But the wysiwyg add's nothing (just title is showing), and using the original with content shows the original form.
I have the code, copied exactly from that page, as a snippet which is running on the front end only.
I've test it is running by putting a die("Here"); in front of each function and the first two are "working", ie die is being called.
But this function isn't:
add_filter( 'rwmb_content_field_meta', function() { ...
The die statement is never called - not when the form is displayed or when it is submitted.
What could I be doing wrong please?
Thanks
John
Hi John,
The field wysiwyg
is created in a meta box so you need to add the meta box ID to attribute id
of the frontend submission shortcode to show the field. For example:
$meta_boxes[] = [
'title' => 'Test',
'post_types' => 'post', // Change 'post' to your custom post type.
'id' => 'my-meta-box', //meta box ID
'fields' => [
// Register a wysiwyg field of which the content is saved as post content.
[
'type' => 'wysiwyg',
'id' => 'content', // This is a must!
'name' => 'Fake content',
'std' => $post_content,
],
],
];
[mb_frontend_form id="my-meta-box" post_fields="title"]
Ah, thanks! Although I'm a programmer, I've not used metabox programmatically before and didn't realise this.