Categories
General

Add Buttons to your wordpress Editor

Today I worked with adding a button on simple editor of wordpress which will take your input using javascript prompt function, process it and then add it to the editor itself. While searching in net, I got it working very cool. All you have to do is run a javascript query which will do some DOM operation on wordpresse’s admin section. This one helped a lot, I just simplified it in my code below

<?
add_action('admin_footer', 'wpaq_addsome');

function wpaq_addsome(){

		echo <<<EOT
				<script type="text/javascript">
					<!--
						if(wpaqToolbar = document.getElementById("ed_toolbar")){
							var wpaqNr, wpaqBut, wpaqStart, wpaqEnd;
EOT;
			echo <<<EOT
							wpaqNr = edButtons.length;
							edButtons[wpaqNr] = new edButton('ed_wpaqNew','New','', '','');
							var wpaqBut = wpaqToolbar.lastChild;
							while (wpaqBut.nodeType != 1){
								wpaqBut = wpaqBut.previousSibling;
							}
							wpaqBut = wpaqBut.cloneNode(true);
							wpaqToolbar.appendChild(wpaqBut);
							wpaqBut.value = 'Add some Value';
							wpaqBut.title = wpaqNr;
							wpaqBut.onclick = someFunction;
							wpaqBut.id = "ed_wpaqFlake";
EOT;

echo
	function someFunction() {
	myField = document.getElementById('content');
	var myValue = prompt('Enter the value:', '');
	if (myValue) {
		edInsertContent(myField, myValue);
	}
}
				</script>
EOT;
}
?>

7 replies on “Add Buttons to your wordpress Editor”

As far as I know Rahat Ayub is doing that. I am not localizing wordpress. There is another project running on wordpress.org where people are localizing wordpress into bangla.

Don’t you think Rahat is one of the talkers who likes to talk. If you look into the past, Rahat has started *many* projects and none of them are finished so far.

Dark,
If you want to localize FireFox, you can start working on that. Not as a Meghdoot guy, you can do it directly from WordPress’ site.

“you can do it directly from WordPress’ site.”

DONT UNDERSTEND

এই .PO ফাইলটার ব্যাপারে বুঝলামনা । ওয়ার্ডপ্রেস , পিএচপি বিবি এগুলা হইতেছে ওয়েব এ্যাপলিকেশন । যেমন পিএচপি বিবি বাংলা করা যায় .PHP ল্যঙ্গুইজ ফাইলে র
থেকে । কিন্তু এই পো র ব্যাপারে কনফিউজ আমি । আমার ওয়ার্ডপ্রেস হোমসার্ভারে ইন্সটল করা আছে । এখন আমি কিভাবে সেই po ফাইলটা দিয়ে এটারে বাংলায় বানাবো ? কিলিয়ার করেন

Leave a Reply

Your email address will not be published. Required fields are marked *