How to Add TinyMCE to ClassiPress

Posted on July 12, 2009

This is a feature that everyone has been asking for and I’ve finally got around to implementing it. You can now add an HTML WYSIWYG editor to the new ad submission description field. So if you’ve enabled the “Allow HTML Code” option in CP, your customers will be able to do some basic html markup to their ad submission!

This feature will be in v2.9.3 but if you wanted to get a head start and use it now, you can easily add it to your site. Use at your own risk though. This code worked fine for me but your configuration might be different.

All you need to do is edit post-form.php and paste in the following code at the top.

<?php if ( get_option('filter_html') == "yes" ) { ?>
 
<script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js"></script>
<script type='text/javascript' src='../wp-includes/js/tinymce/langs/wp-langs-en.js?ver=3241-1141'></script>
 
<script type="text/javascript">
<!--
tinyMCE.init({
mode : "exact",
theme : "advanced",
elements : "description",
theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",
theme_advanced_buttons2 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
languages : 'en',
disk_cache : true,
width : "395",
height : "200"
});
-->
</script>
 
<?php } ?>

You might need to change your .js paths or some of the parameters but this should work. I’ve set it up to use the existing tinyMCE code bundled with WordPress so you don’t need to download or install the core tinyMCE package.

If you get everything working properly, it should look like this:

tinyMCE-classipress

Then try submitting a new ad and see how it works out. For examples and additional parameters you can add/remove, go visit the tinyMCE example page and have at it.

Share this Post
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • TwitThis

16 Responses to “How to Add TinyMCE to ClassiPress”

  1. Jeff
    Jul 13, 2009
    Reply

    This works great after refreshing browser cache. Now, how about for the edit ad page?


  2. David
    Jul 13, 2009
    Reply

    You should be able to add the same code to the tpl-edit-ad.php file around line 130 (below the other javascript about halfway down).


  3. This should be helpful to whom bought the classpress theme!


  4. James
    Jul 18, 2009
    Reply

    Could classipress be modified to be a jobs board?


  5. dubya
    Jul 19, 2009
    Reply

    Works great on the post form, but I can’y seem to get it to work on the edit form. Any ideas?


  6. Jeff
    Jul 19, 2009
    Reply

    I have the same problem and posted it on the forums for resolution.


  7. leland
    Jul 20, 2009
    Reply

    What other things will be added in the 2.9.3 edition


  8. junserey
    Jul 21, 2009
    Reply

    It should be included in Edit Ad as well.


  9. darkcast
    Jul 27, 2009
    Reply

    hi, im sorry im not a coder but could anyone tell me were exactly should this code go ? in the top were ??
    what line
    1
    2
    3
    i tried place it everywhere even replacing the fist lines of code and all i get are errors !


  10. dubya
    Jul 28, 2009
    Reply

    darkcast – The code needs to go at the very top of your post-form.php file. It needs to start at line 1. If you still can’t get it working, check the forum.


  11. Congratulations on your project, I gained this week and I am very happy. In relation to the edit page so do not hesitate to put also the tinyMCE?


  12. thiet ke logo
    Sep 18, 2009
    Reply

    I try to add this script to top the post-form.php. It works fine, but it has a very very small problem that the page load header first and continoue load the content, it so slowly.

    I cut and paste everywhere, but still this problem.

    What can i do now?


  13. thiet ke logo
    Sep 18, 2009
    Reply

    ah, if i don’t add this script, the page load all page and so fast.


  14. Duarte
    Oct 09, 2009
    Reply

    fantastic upgrade :)


  15. marcelo
    Nov 24, 2009
    Reply

    Olá amigo sou do Brasil, cidade de São Paulo. Tentei colocar o código no arquivo : tpl-edit-ad.php , porém nao tive sucesso… pode me explicar melhor ? qual seria o lugar exato? seria o código inteiro? me ajude… abraços

    Hello friend I am from Brazil, São Paulo. I tried to put the code in
    File: tpl-edit-ad.php, but I had no success … can you explain
    better? what is the exact place? be the entire code? help me …
    hugs


  16. ide
    Nov 29, 2009
    Reply

    I like this (tinycme on classipress) very much.
    thanks for your project



Leave a Reply


My Calendar

March 2010
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
293031