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
);
@draftdesignweb
Copy link

We encountered an error activating your snippet, please check the syntax and try again.

@hivepress
Copy link
Author

If you used the Code Snippets plugin please make sure that you didn't copy the first line because the Code Snippets plugin already pre-adds it.

@draftdesignweb
Copy link

Still giving the same error removing the first line, certainly with snippet I had to remove it.

@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 👍

@Kienma-prince
Copy link

Hello, can you write a custom code to make the mobile display same as the desktop display? No more responsive display.

@hivepress
Copy link
Author

Hello, can you write a custom code to make the mobile display same as the desktop display? No more responsive display.

This is a common issue not specific to HivePress, but adding the HTML meta tag mentioned here https://stackoverflow.com/questions/19165545/disable-css-for-responsive-design to the theme's header.php file should do the job.

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