Archive for the ‘ WORDPRESS ’ Category

wordpress tinymce add button

i been working out for a new plugin which is called the files attachment plugin. for now i want share to you how add button in can download it here WordPress Attach File

First, i will show the php code how to hook in wordpress.  this line allow you to hook in tinymce

add_filter(‘mce_external_plugins’, ‘attachDaw’); //This function include editor_plugin.js;

add_filter(‘mce_buttons’, ‘attachAddButton’, 0); //hook this function to  tinymce

add_action(‘plugins_loaded’, ‘loadlibrary’); // loaded jquery plugin..

Set function..

function attachAddButton($button){

array_push($button, "separator", "daganPlugin");

return $button;

function attachDaw($plugin_array){
$url = trim(get_bloginfo('url'), "/")."/wp-content/plugins/sumifruAttachFile/editor_plugin.js";
$plugin_array['daganPlugin'] = $url; //call jscript editor_plugin.js

return $plugin_array;


function loadlibrary(){

wp_enqueue_script('jquery'); //call jquery script

js script editor_plugin.js
the init is link up container bind with function attachDaw($plugin_array)

ed.addCommand('string Name', 's:Object')
ed.addButton('string Name', s:Object)
you can see the documentation here

init : function(ed, url){
ed.addCommand('OpenDawBeh', function() {{
file : url + '/attachmeFiles.php', //source file
width : 500, // max width
height : 300, // max height
inline : 1
}, {
plugin_url : url // Plugin absolute URL

ed.addButton('daganPlugin', {
title : 'Attach Files', // title plugin name
cmd : 'OpenDawBeh', // call ed.addCommand('OpenDawBeh')
image: url + "/attachment.png" //button Image

ed.onNodeChange.add(function(ed, cm, n) {
cm.setActive('daganPlugin', n.nodeName == 'IMG');

// Add a node change handler, selects the button in the UI when a image is selected

getInfo : function() {
return {
longname : 'amew ka he',
author : 'Ryl Denn Sagun',
authorurl : '',
infourl : '',
version : "1.0"

tinymce.PluginManager.add('daganPlugin', tinymce.plugins.daganPlugin);

WordPress development plugin status

its been 3 Saturdays and Sundays i started developing wordpress plugin but perhaps my focus in studying wordpress not enough because i write codes at the same time watching fairyTail anime. hehe usually when i get bored coding. i automatically switch tabs and watch fairytail. :( .. but i have a good news. as estimated i already finish 60% complete with my guestbook plugin.
im very excited with this plugin because its my first plugin and also im Amaze with wordpress function and components such a Brilliant structures. i already know some function of it but not enough. Someday i will my master it. if the development stops hehehe.. :)