Replacing WYSIWYG editor with medium editor?
Support › MB Frontend Submission › Replacing WYSIWYG editor with medium editor?Resolved
- This topic has 6 replies, 2 voices, and was last updated 3 years, 6 months ago by
John.
-
AuthorPosts
-
September 29, 2021 at 1:06 AM #31056
John
ParticipantHi,
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
JohnSeptember 29, 2021 at 2:27 PM #31066Long Nguyen
ModeratorHi John,
You can use the
textarea
field to allow the users to use the medium editor on the frontend, remove the default post fieldcontent
in the frontend submission shortcode. Then follow this tutorial to update the post content by thetextarea
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-fieldsSeptember 29, 2021 at 2:57 PM #31067John
ParticipantThanks 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
JohnSeptember 29, 2021 at 4:59 PM #31070John
ParticipantI'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.
September 29, 2021 at 10:34 PM #31077John
ParticipantHi 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
JohnSeptember 30, 2021 at 12:34 PM #31085Long Nguyen
ModeratorHi John,
The field
wysiwyg
is created in a meta box so you need to add the meta box ID to attributeid
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"]
September 30, 2021 at 12:59 PM #31087John
ParticipantAh, thanks! Although I'm a programmer, I've not used metabox programmatically before and didn't realise this.
-
AuthorPosts
- You must be logged in to reply to this topic.