Poner código en tus post de wordpress

Llevaba tiempo intentando instalar algún plugin para poder colocar código (Javascript, CSS, HTML...) y al final me he decantado por uno muy sencillo de instalar y muy completo.

INSTALACION

  • Descargar el archivo IG_Syntax_Hiliter.zip
  • Descomprimimos la carpeta que hay dentro del .zip
  • Copiamos la carpeta que hay dentro de esa carpeta (ig_syntax hiliter plugin) al directorio /wp-content/plugins/
  • Renombramos la carpeta "ig_syntax hiliter plugin" a "ig_syntax hiliter"
  • Activar el plugin en el menú de administración
  • Modificamos el archivo quicktags.js que se encuentra en wp-includes/js/” Ahí encontrarás en la línea # 126 lo siguiente:
JavaScript:
  1. edButtons[edButtons.length] =
  2. new edButton('ed_more'
  3. ,'more'
  4. ,'<span id="more-32"></span>'
  5. ,''
  6. ,'t'
  7. ,-1
  8. );

Añade acto seguido:

JavaScript:
  1. //----- Start iG:Syntax Hiliter Plugin's Quick Tags -----
  2. edButtons[edButtons.length] =
  3. new edButton('ed_shAS'
  4. ,'ActionScript'
  5. ,'[as]'
  6. ,'[/as]'
  7. ,''
  8. );
  9. edButtons[edButtons.length] =
  10. new edButton('ed_shASP'
  11. ,'ASP'
  12. ,'[asp]'
  13. ,'[/asp]'
  14. ,''
  15. );
  16. edButtons[edButtons.length] =
  17. new edButton('ed_shC'
  18. ,'C'
  19. ,'[c]'
  20. ,'[/c]'
  21. ,''
  22. );
  23. edButtons[edButtons.length] =
  24. new edButton('ed_shCPP'
  25. ,'C++'
  26. ,'[cpp]'
  27. ,'[/cpp]'
  28. ,''
  29. );
  30. edButtons[edButtons.length] =
  31. new edButton('ed_shCSHARP'
  32. ,'C#'
  33. ,'[csharp]'
  34. ,'[/csharp]'
  35. ,''
  36. );
  37. edButtons[edButtons.length] =
  38. new edButton('ed_shCSS'
  39. ,'CSS'
  40. ,'[css]'
  41. ,'[/css]'
  42. ,''
  43. );
  44. edButtons[edButtons.length] =
  45. new edButton('ed_shDELPHI'
  46. ,'DELPHI'
  47. ,'[delphi]'
  48. ,'[/delphi]'
  49. ,''
  50. );
  51. edButtons[edButtons.length] =
  52. new edButton('ed_shHTML'
  53. ,'HTML'
  54. ,'[html]'
  55. ,'[/html]'
  56. ,''
  57. );
  58. edButtons[edButtons.length] =
  59. new edButton('ed_shJAVA'
  60. ,'JAVA'
  61. ,'[java]'
  62. ,'[/java]'
  63. ,''
  64. );
  65. edButtons[edButtons.length] =
  66. new edButton('ed_shJS'
  67. ,'JavaScript'
  68. ,'[ js ]'
  69. ,'[ / js ]'
  70. ,''
  71. );
  72. edButtons[edButtons.length] =
  73. new edButton('ed_shMySQL'
  74. ,'MySQL'
  75. ,'[mysql]'
  76. ,'[/mysql]'
  77. ,''
  78. );
  79. edButtons[edButtons.length] =
  80. new edButton('ed_shPERL'
  81. ,'PERL'
  82. ,'[perl]'
  83. ,'[/perl]'
  84. ,''
  85. );
  86. edButtons[edButtons.length] =
  87. new edButton('ed_shPHP'
  88. ,'PHP'
  89. ,'[php]'
  90. ,'[/php]'
  91. ,''
  92. );
  93. edButtons[edButtons.length] =
  94. new edButton('ed_shPYTHON'
  95. ,'PYTHON'
  96. ,'[python]'
  97. ,'[/python]'
  98. ,''
  99. );
  100. edButtons[edButtons.length] =
  101. new edButton('ed_shRuby'
  102. ,'RUBY'
  103. ,'[ruby]'
  104. ,'[/ruby]'
  105. ,''
  106. );
  107. edButtons[edButtons.length] =
  108. new edButton('ed_shSMARTY'
  109. ,'SMARTY'
  110. ,'[smarty]'
  111. ,'[/smarty]'
  112. ,''
  113. );
  114. edButtons[edButtons.length] =
  115. new edButton('ed_shSQL'
  116. ,'SQL'
  117. ,'[sql]'
  118. ,'[/sql]'
  119. ,''
  120. );
  121. edButtons[edButtons.length] =
  122. new edButton('ed_shVB'
  123. ,'Visual Basic'
  124. ,'[vb]'
  125. ,'[/vb]'
  126. ,''
  127. );
  128. edButtons[edButtons.length] =
  129. new edButton('ed_shVBNET'
  130. ,'VB.NET'
  131. ,'[vbnet]'
  132. ,'[/vbnet]'
  133. ,''
  134. );
  135. edButtons[edButtons.length] =
  136. new edButton('ed_shXML'
  137. ,'XML'
  138. ,'[xml]'
  139. ,'[/xml]'
  140. ,''
  141. );
  142. edButtons[edButtons.length] =
  143. new edButton('ed_shCode'
  144. ,'CODE'
  145. ,'[code]'
  146. ,'[/code]'
  147. ,''
  148. );
  149. //----- End iG:Syntax Hiliter Plugin's Quick Tags -----

Ahora ya tienes 21 nuevos botones en tu editor con éstos nombres:
ActionScript, ASP, C, C++, C#, CSS, DELPHI, HTML, JAVA, JavaScript, MySQL, PERL, PHP, PYTHON, RUBY, SMARTY, SQL, Visual Basic, VB.NET, XML & CODE que te generarán sus respectivas etiquetas.

Yo solo instalé estos 8 lenguajes: HTML, ActionScript , JavaScript, MySQL, PHP, SQL, XML, Code


Sobre este Post