Error when using tinyMCE in my wordpress settings page - wordpress

I tried using tinyMCE directly from the package included with:
<script src="//tinymce.cachefly.net/4.0/tinymce.min.js"></script>
And then I just set this in my jQuery file:
tinymce.init({
selector: "textarea"
});
Now, for some reason that I can't understand, all my textareas are hidden (visibility:hidden) and nothing else is showing up. I am modifying the DOM in this file with jQuery but I tried to insert a non-modified textarea and still nothing shows up. Is there something with Wordpress that makes this error? I am writing this in the functions.php-file.

Or maybe you should simply use wp_editor() php function
http://codex.wordpress.org/Function_Reference/wp_editor

Related

Disabling inline_styles on TinyMCE for Wordpress

I would like to force TinyMCE for wordpress to stop adding inline CSS for everything I do during edition.
I found this page that says that I should add this snippet
tinyMCE.init({
...
inline_styles : false
});
add to where? The page, and by the way, the entire TinyMCE documentation fails to tell where we should add the valuable snippets they mention.
Any ideas?
I'm not entirely sure that you can disable the inline-styles via TinyMCE, however the filter used to change default TinyMCE settings is: tiny_mce_before_init, so assuming that inline_styles is still a valid option that can be overwritten, you could theoretically do it like this.
function my_format_TinyMCE( $init ) {
$init['inline_styles'] = false;
return $init;
}
add_filter( 'tiny_mce_before_init', 'my_format_TinyMCE' );
There is a note about it in the source code and a bit of documentation here

How to add "code" format button to Tinymce 4 in WordPress 3.9

Tinymce offers an inline code formatting option that wraps the <code> tag around content. But WordPress does not include this. I think that there must be an easy way to enable it. I have seen discussing on how to do this in earlier versions of WP (with Tinymce 3) in threads like Add "code" button to wordpress tinyMCE ,
but I can't see how to "translate" this into Tinymce 4.
I tried the following. It gives me the Source Code but not the code tag.
// Add <code> support to the Visual Editor
// Load the code TinyMCE plugin
function my_TinyMCEplugins($plugin_array) {
$plugin_array['code'] = get_bloginfo('template_directory') . '/inc/code/plugin.min.js';
return $plugin_array;
}
add_filter('mce_external_plugins', 'my_TinyMCEplugins');
// Add the code button into the toolbar
function my_TinyMCE($in) {
$in['toolbar2'].=',code';
return $in;
}
add_filter('tiny_mce_before_init', 'my_TinyMCE' );
Thanks for any help!
Actually the TinyMCE code plugin is NOT used to insert <code> tags. It is used to edit the source html code, which is redundant in wordpress since you can just click the 'text' tab.
This wordpress plugin will add that functionality for you: https://wordpress.org/plugins/tinymce-code-button/screenshots/.

Wordpress - Adding TinyMCE on Frontend into jQuery UI widget

I'm creating a Wordpress App. It consists on using custom fields on custom type, for managing personal projects.
My issue: I want to add the admin editor (tinyMCE) on frontend. Considering that I can have many textareas that will begin TinyMCE editors. So, I used this code:
PHP (on theme functions.php):
// TINY-MCE EDITOR ON FRONTEND
add_filter('wp_head','add_tinymce_editor');
function add_tinymce_editor(){
wp_admin_css('thickbox');
wp_enqueue_script('wp-tinymce');
wp_enqueue_script('tinymce');
wp_enqueue_script('editor');
add_thickbox();
}
JS (on theme single-projects.php):
jQuery(document).ready(function(){
// EDITORS
tinyMCE.init({
mode : "specific_textareas",
theme : "simple",
editor_selector :"tinymce_enabled"
});
});
On JS I set the "editor_selector" with a Class for all textareas that will begin tinyMCE editors. I cannot assign a single ID for each textareas because these can be 4 or 5 or 6, or more!!!
HTML: (on theme single-projects.php):
<textarea name="new-task-description" id="new-task-description"
class="tinymce_enabled required"></textarea>
Each textarea is present on Jquery UI Accordions.
Now, my problem is, on Firebug (or browser console) I get this error:
tinyMCE is not defined
What's wrong?
thanks in advance!!!
With Wordpress 3.3 you can use wp_editor() which is a lot easier.
http://codex.wordpress.org/Function_Reference/wp_editor
The right way to include scripts is add_action('wp_enqueue_scripts', 'tinymce_editor');
If tinymce is not defined the file tiny_mce.js has not been loaded on the page. Make sure the file gets loaded eigther directly or with the means wordpress offers.

use javascripts objects into a wordpress theme

I save an html page that has an image rotator that work by using javascript, and after I save it work correctly.
I convert this html page to a wordpress theme but the rotator don't work anymore.
what's the problem?
please help me.
Wordpress insert embeded jquery script using wp_enqueue_script.
Check that jQuery inserted just one time in your theme! You can disable auto insertion by adding this code in function.php file:
wp_deregister_script('jquery');
and take a look at this.

jQuery Gallery is not working in WordPress

Even though, I used same code for both of them http://bda.ctuproject.com/ is not showing tip image. When you go over any item in http://bda.ctuproject.com/wp-content/themes/twentyten/exam/index.html you will see that box will come up saying what is that picture but it's not doing it when I put it in WordPress. Why any ideas ?
http://bda.ctuproject.com
http://bda.ctuproject.com/wp-content/themes/twentyten/exam/index.html
i think you're calling the jquery script twice
As #Colby said, you are loading jQuery twice. Try putting this into your active theme's functions.php file to deregister the WP jQuery load:
if( !is_admin()){
wp_deregister_script('jquery');
}

Resources