Этот плагин не тестировался с последними 3 основными выпусками WordPress. Скорее всего, он уже не поддерживается и может быть несовместим с текущими версиями WordPress.

Code Snippet


Code Snippet was created by Roman Roan and originally hosted at http://blog.enargi.com. It is powered by the GeSHi engine and is quite possibly the best syntax highlighting engine for WordPress. A large number of languages are supported and it can be easily extended. Since his blog is no longer functioning, I’m attempting to keep his wonderful contribution available so I’ve given it a home at http://blog.hackerforhire.org/code-snippet/. If you find any bugs with it, let me know and I will do my best to resovle them.


The original author recommended always wrapping your code in a <pre> tag; however, most times you generally don’t need to. To use it, simply surround your code with as such and specify your language type:

[code lang=»c»]
int main(int argc, char** argv) { return 0; }

And the result is:

int main(int argc, char** argv) { return 0; }

Supported Languages

This tool uses the GeSHi library. Any supported language there should work just fine with Code Snippet. See http://qbnz.com/highlighter/ for details.


  1. Copy archive to wp-content/plugins directory
  2. Extract the zip file
  3. When extracted properly you should have following directory structure: /wp-content/plugins/codesnippet
  4. Since I have not torn through the code, the plugin will probably not work if extracted/copied in diffrenet directory.
  5. Enable the plugin in the Plugin interface

Часто задаваемые вопросы

Do I need to wrap this my code in <code> block?

No. Instead, wrap your code in a <pre> block and then use [code lang=»lang»][/code] to wrap your code.

How can I customize the code block layout?

In the WordPress Admin interface, under Options -> Code Highlighting, you can specify a custom CSS stlye to wrap your code blocks in. While the preview button is nice, Firebug would be the tool I would recommend.

Can I use this with custom wordpress themes?

Yes; however, you might need to do a little bit of tweaking. JR found that CodeSnippet automatically adds a link if you’re theme is using wp_head; however, if it isn’t, you’ll need to add the link to the codesnippet/codesnippet.css stlye sheet to your header and you’ll also have to define the ‘codesnip-container’ element. The default value is: border:1px solid #ccc; background:#eee; padding: 5px;margin:10px;


After upgrading my server to use PHP 7 as pestered to do so by WordPress, this plugin caused my site to break with a 500 error. PHP logs were able to show me that this plugin was the source of the error and after disabling it manually by SSHing into my box, my site was able to load again. There appear to be no updates for it and so WordPress refuses to reactivate it.
Посмотреть 1 отзыв

Участники и разработчики

«Code Snippet» — проект с открытым исходным кодом. В развитие плагина внесли свой вклад следующие участники:

Перевести «Code Snippet» на ваш язык.

Заинтересованы в разработке?

Посмотрите код, проверьте SVN репозиторий, или подпишитесь на журнал разработки по RSS.

Журнал изменений


  • Updating verison mis-match again
  • Updating to GeSHi


  • Updating readme. Validated testing with 2.9.2


  • Updating tag in plugin causing incorrect version to display


  • GeSHi engine, rendering bug-fix


  • Update to work with plugin security in 2.8.1


  • Tested with WordPress 2.0


  • various improvements


  • Fixed: Plugin Options panel is not displayed (Options>Code Highlighting)


  • Fixed: RSS feeds got broken with code snippets


  • Fixed: invalid css stylesheet link when WordPress is not installed in site root


  • Fixed plugin produce errors under PHP 4


  • Initial release