Skip to content

Instantly share code, notes, and snippets.

@hivepress
Created April 26, 2022 16:13
Show Gist options
  • Save hivepress/4ed3d319ab220c6e005f58a4da95e504 to your computer and use it in GitHub Desktop.
Save hivepress/4ed3d319ab220c6e005f58a4da95e504 to your computer and use it in GitHub Desktop.
Enable rich text (HTML) editor for the listing description #hivepress #listings
<?php
add_filter(
'hivepress/v1/models/listing',
function( $model ) {
$model['fields']['description']['editor'] = true;
return $model;
},
1000
);
@hivepress
Copy link
Author

It seems to be ok when I test it, make sure that you copied the whole snippet except the <?php line (the first one).

@draftdesignweb
Copy link

draftdesignweb commented Nov 3, 2022 via email

@draftdesignweb
Copy link

Error,...

image

@hivepress
Copy link
Author

For some reason the quote characters were copied incorrectly, please replace double quotes on line 2 with single ones, or try to re-copy the snippet.

@draftdesignweb
Copy link

Now it worked correctly!
Is it possible in the menu the option of images or hyperlinks?
image

@hivepress
Copy link
Author

Yes, you can pass an array of the editor configuration instead of "true", the same as accepted here in "settings" https://developer.wordpress.org/reference/functions/wp_editor/ Please use our support forum if there are other issues https://community.hivepress.io/

@snokamedia
Copy link

On the submit-listing/details/ page if initially no category is selected, then a category is selected, the editor doesn't load until the page refreshes. The editor .css does but the .js doesn't. This makes the text white because of editor.min.css and the field completely unusable.

@hivepress
Copy link
Author

Yes, this is a known bug - unfortunately there's no temporary fix for this but we'll fix this in the next update. Since the form is refreshed without the page refresh, WordPress doesn't initialize the editor.

@snokamedia
Copy link

@hivepress 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment