<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dev4Press&#187; init Tag Archives, page 1 of 1 | Dev4Press</title>
	<atom:link href="http://www.dev4press.com/tag/init/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dev4press.com</link>
	<description>Premium Plugins and Themes for WordPress</description>
	<lastBuildDate>Thu, 20 Jun 2013 09:54:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Add rich text editor to your plugin</title>
		<link>http://www.dev4press.com/2010/tutorials/wordpress/tips/add-rich-text-editor-to-your-plugin/</link>
		<comments>http://www.dev4press.com/2010/tutorials/wordpress/tips/add-rich-text-editor-to-your-plugin/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 22:15:03 +0000</pubDate>
		<dc:creator>MillaN</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[buttons]]></category>
		<category><![CDATA[css files]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[editor php]]></category>
		<category><![CDATA[elements]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[hooks]]></category>
		<category><![CDATA[init]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[language php]]></category>
		<category><![CDATA[parameter content]]></category>
		<category><![CDATA[php editor]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[rich text editor]]></category>
		<category><![CDATA[tab index]]></category>
		<category><![CDATA[textarea element]]></category>
		<category><![CDATA[tinymce]]></category>

		<guid isPermaLink="false">http://www.dev4press.com/?p=2651</guid>
		<description><![CDATA[Sometimes is very useful to be able and use existing WordPress rich editor within your plugins. TinyMCE editor built in WP can be easily reused and you can even set some elements. Following example will work in WordPress 2.8 and newer including latest WP 3.0.]]></description>
				<content:encoded><![CDATA[<div id="attachment_2654" class="wp-caption alignright" style="width: 280px"><a title="Editor Example" rel="lightbox" href="http://cdn.dev4press.com/wp-content/uploads/2010/07/editor_example.png"><img class="size-medium wp-image-2654" title="Editor Example" src="http://cdn.dev4press.com/wp-content/uploads/2010/07/editor_example-300x167.png" alt="Editor Example" width="270" height="150" /></a><p class="wp-caption-text">Editor Example</p></div>
<p>Sometimes is very useful to be able and use existing WordPress rich editor within your plugins. TinyMCE editor built in WP can be easily reused and you can even set some elements. Following example will work in WordPress 2.8 and newer including latest WP 3.0.</p>
<p>There are two parts to this procedure. One is to load needed JS and CSS files, and other to call the editor where you want it displayed.</p>
<h3>Loading Editor</h3>
<p>To load TinyMCE you need to use the following code. First two lines attach hooks to init and head actions. Two functions hooked follow after. One loads JavaScript needed, and second actually loads the editor. Line that enqueues the media upload element is needed only if you use media buttons.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
add_action('admin_init', 'editor_admin_init');
add_action('admin_head', 'editor_admin_head');

function editor_admin_init() {
  wp_enqueue_script('word-count');
  wp_enqueue_script('post');
  wp_enqueue_script('editor');
  wp_enqueue_script('media-upload');
}

function editor_admin_head() {
  wp_tiny_mce();
}
?&gt;</pre>
<h3>Display editor</h3>
<p>Editor is displayed using one function. This function is defined as follows:</p>
<blockquote><p><strong>the_editor</strong>($content, $id = &#8216;content&#8217;, $prev_id = &#8216;title&#8217;, $media_buttons = true, $tab_index = 2)</p></blockquote>
<p>First parameter, $content will be displayed inside the editor. Next is $id, and the textarea element created will have that ID. You can use it to get the content from the editor. Next parameter can be used the specify previous element in the form for tab moving (last parameter). And, $media_buttons allow you to display or hide media upload buttons above the editor.</p>
<p>Here is an example:</p>
<pre class="brush: php; title: ; notranslate">&lt;div id=&quot;poststuff&quot;&gt;
&lt;?php
  the_editor(&quot;&quot;, &quot;content&quot;, &quot;&quot;, true);
?&gt;
&lt;/div&gt;</pre>
<p>This you need to add on your panel where you want editor displayed. It will fit into any DIV you want so that you can limit the size and dimenzions. Using &#8220;poststuff&#8221; DIV is important so that all elements are styled properly.</p>
<p>Content of the editor is available as part of the form on submit named as <strong>content</strong>, or whatever you set as ID in the code above. If you want to access to content from JavaScript use this:</p>
<blockquote><p><strong>tinyMCE.activeEditor.getContent();</strong></p></blockquote>
<p>That&#8217;s all you need to know (for now), you can use anything tinyMCE object offers from JavaScript. If you need more help, leave a comment.</p>
<script src="http://feeds.feedburner.com/~s/adsense@gdragon.info?i=http://www.dev4press.com/2010/tutorials/wordpress/tips/add-rich-text-editor-to-your-plugin/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://www.dev4press.com/2010/tutorials/wordpress/tips/add-rich-text-editor-to-your-plugin/feed/</wfw:commentRss>
		<slash:comments>79</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk: enhanced
Content Delivery Network via cdn.dev4press.com

 Served from: www.dev4press.com @ 2013-06-20 13:34:16 by W3 Total Cache -->