0

I am using the tinyMCE visual editor to allow users of my site to submit some content.

I would like to layout the guidelines of their post to them (eg: "Be specific, be thorough"). The most obvious way to do this is ordinarily with the placeholder attribute.

However, I understand this is not an option with the visual editor.

Therefore, I though of showing a bootstrap popover on focus of the visual editor. However, I am not able to achieve this either (perhaps because the visual editor iframe uses elements that don't trigger focus).

Is there a way that I can do either of the above two things?

If not, how can I present the user with some guidelines for writing the post? (I feel like if I don't place the guidelines within the editor or as a response to focusing on the editor, it will receive less attention).

Thanks.

  • You can use jquery to display some text into the given area, then remove it either on hover, on focus or if the content area has text typed into it. – klewis Oct 28 '16 at 10:47
  • Can you specify how to do this? It's not a textarea element, it's a iframe. Therefore I was unable to do this (specifically, I couldn't select the p element within the iframe in order to manipulate it via jQuery. – theyuv Oct 28 '16 at 12:34
0

If you use the build-in tinyMCE editor you can do it this way:

$content = '';
$editor_id = 'mycustomeditor';

wp_editor( $content, $editor_id );

Fill $content with your guidelines and they are shown if you open it.

See https://codex.wordpress.org/Function_Reference/wp_editor

  • But this fills it with actual content, the user needs to highlight it and delete it. It's confusing and I don't think it's meant to be used to show the user guidelines and messages. – theyuv Oct 28 '16 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.