Hot answers tagged

6

I suggest using keywords for them. so you would do something like [shortcode attr="single_quote double_quote"]test[/shortcode]. Then, while parsing the shortcode you can change them back.


5

Make sure you've registered the stylesheet for the editor: add_editor_style( 'http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css' ); This should be in your functions.php https://codex.wordpress.org/Editor_Style


3

I was hunting for a way to do this, and no-one seems to mention the wp_editor_settings filter. This worked for me: function my_editor_settings($settings) { $settings['quicktags'] = false; return $settings; } add_filter('wp_editor_settings', 'my_editor_settings');


2

If you don't need wp_editor in front-end, I think its OK. Here a little bit different option settings with your tinymce init. I use this without wp_editor in front-end. <script> jQuery( document ).ready( function( $ ) { tinymce.init( { mode : "exact", elements : 'pre-details', theme: "modern", skin: "lightgray", ...


2

I think you mean the font color inside the TinyMCE editor. The wp_editor() function have the settings parameter, there you reference to an var like ``. This parameter need a array and this array can use a lot of parameters. The follow example demonstrate this and the codex have also a documentation. $settings = array( 'wpautop' => true, ...


2

In theme options, I had to define wp_editor_settings. So, just in options.php, I used: //WP_editor settigs $wp_editor_settings = array( 'wpautop' => true, // Default 'textarea_rows' => 15, 'tinymce' => array( 'plugins' => 'fullscreen,wordpress,wplink, textcolor' )); Basically, I'm adding tinymce ...


2

If you wait for the SetupEditor event then you can access the editors: add_action( 'admin_print_footer_scripts', function () { ?> <script type="text/javascript"> jQuery(function ($) { if (typeof tinymce !== 'undefined') { tinymce.on('SetupEditor', function (editor) { if (editor.id === 'contentLeft') { ...


2

You can adjust the attachment query in the media library popup, through the ajax_query_attachments_args filter. Here are two PHP 5.4+ examples: Example #1: Show only attachments that where uploaded during the last 24 hours: /** * Media Library popup * - Only display attachments uploaded during the last 24 hours: */ add_filter( ...


1

Add the filter "ajax_query_attachments_args" in this way and URLs variables are sent to the class WP_Query the default is to send array(7) { ["orderby"]=> string(4) "date" ["order"]=> string(4) "DESC" ["posts_per_page"]=> string(2) "40" ["paged"]=> string(1) "1" ["post_type"]=> string(10) ...


1

The wordpress editor is designed to work in wordpress enviroment and there is not much point in trying to somehow make it work "outside" of wordpress. You might hack it but any wordpress upgrade might break it. You need to use your php in the wordpress context by making a page template for your theme out of the your php.


1

I believe the helper you're looking for (assuming we're not dealing with a custom post type) is: <?php remove_post_type_support('page', 'editor'); ?> When dealing with a custom post type you can exclude 'editor' from the 'supports' parameter to initialize the post type without the editor window. Finally, if you are trying to disable the editor only ...


1

This is how the tinymce statusbar displays on my intsall: <div id="mceu_34" class="mce-statusbar mce-container mce-panel mce-stack-layout-item mce-last" hidefocus="1" tabindex="-1" role="group"> <div id="mceu_34-body" class="mce-container-body mce-flow-layout"> <div id="mceu_35" class="mce-path mce-flow-layout-item mce-first ...


1

I'm not a very good coder, I've only asked questions on here, but because no one was able to answer your question, I suppose I'll give it a shot. If I remember correctly, this should remove the toolbars on the tinyMCE: function my_format_TinyMCE( $in ) { $in['toolbar1'] = ''; $in['toolbar2'] = ''; $in['toolbar'] = false; return $in; } ...


1

In WordPress 4.2 the editor was removed on whichever page was assigned to show Latest Posts for whatever reason. The following function below ( original solution found here by crgeary ) will re-add the editor and remove the notification: You are currently editing the page that shows your latest posts. Here's some information on the hooks used: ...


1

You can check this out - wpgallery plugin, this is how they do it for the [gallery] shortcode, basically parsing the shortcodes on the client-side, and replacing them back and forth as you click "Visual" or "Text". Unless you are building a plugin, I would advise you to refrain from using shortcodes - use plain HTML, you'll have an easier time working with ...


1

Simpler steps: 1) in functions.php,add: add_action('init','my_wpEditOUPUTT');function my_wpEditOUPUTT(){ if (isset($_POST['Give_me_editorrr'])){ wp_editor( '' , 'txtrID_'.$_POST['myNumber'], $settings = array( 'editor_class'=>'my_class', 'textarea_name'=>'named_'. $_POST['myNumber'], 'tinymce'=>true , 'media_buttons' => true , ...


1

you're using : // only low case [a-z], no hyphens and underscores $editor = 'contenten'; and then trying to get it by different name: if(isset($_POST['content_en']) && $_POST['content_en'] != '') another thing is u using different keys like @vancoder said also remember to sanitize the data : https://codex.wordpress.org/Data_Validation this ...


1

Might be because you are using a depreciated function for updating/adding the user meta (update_usermeta). You need to use update_user_meta function. WP Codex: https://codex.wordpress.org/Function_Reference/update_user_meta


1

You can pass an array of settings to the editor instance. For possible values please refer to the tinymce documentation, in your case 'init_instance_callback' might be helpful. https://www.tinymce.com/docs/configure/integration-and-setup/#init_instance_callback wp_editor('', 'sedemoeditor', array( 'tinymce' => array( ...


1

What a great question. Here is the function: function add_taxonomies_to_pages() { register_taxonomy_for_object_type( 'post_tag', 'page' ); register_taxonomy_for_object_type( 'category', 'page' ); } add_action( 'init', 'add_taxonomies_to_pages' ); Get back to winning, now.


1

Might be possible that your wp_editor is broken! According to codex you can not use numeric editor ID may only contain lowercase letters and underscores...hyphens will cause editor to not display properly Call wp_editor in this way wp_editor( $nga_textarea_field_1_invalid, 'nga_textarea_field_one' ); textarea_name is not required because by default ...


1

After struggling with it, found the solution which works, in a callback after you add new element: tinymce.execCommand( 'mceAddEditor', true, element.id ); Its strange that there is zero documentation inside codex.


1

The hook is media_send_to_editor. From the source of core. apply_filters ( 'media_send_to_editor', string $html, int $send_id, array $attachment  ) Filter the HTML markup for a media item sent to the editor.


1

Silly mistake, my custom page was missing the <?php wp_footer(); ?>



Only top voted, non community-wiki answers of a minimum length are eligible