WordPressでコードスニペットを投稿する方法

CodeColorerプラグインで簡単にコードスニペットを投稿出来ます。

プラグイン

CodeColorerプラグイン

書き方

[cc lang="php"]
// some code
[/cc]

ショートコード

ccの後にショートコードを書けます。
複数指定可能です。
小文字で有効、大文字で無効に出来ます。

コード 説明
i inline
e escaped
s strict
n line_numbers
b no_border
w no_wrap
l no_links

インライン有効

[cci lang="php"]
// some code
[/cci]

// some code

インライン無効(デフォルト)

[ccI lang="php"]
// some code
[/ccI]
// some code

パラメーター

パラメータ タイプ
lang string
tab_size integer
lines integer
width integer or string
height integer or string
rss_width integer or string
theme string
first_line integer
highlight string
escaped boolean
line_numbers boolean
no_links boolean
inline boolean
strict boolean
nowrap boolean
noborder boolean
no_cc boolean
class string
file string

テーマ

  • default
public static function get_instance( $post_id ) {
  global $wpdb;
  • blackboard
public static function get_instance( $post_id ) {
  global $wpdb;
  • dawn
public static function get_instance( $post_id ) {
  global $wpdb;
  • mac-classic
public static function get_instance( $post_id ) {
  global $wpdb;
  • twitlight
public static function get_instance( $post_id ) {
  global $wpdb;
  • vibrant
public static function get_instance( $post_id ) {
  global $wpdb;
  • geshi
public static function get_instance( $post_id ) {
  global $wpdb;
  • railscasts
public static function get_instance( $post_id ) {
  global $wpdb;
  • solarized-light
public static function get_instance( $post_id ) {
  global $wpdb;
  • solarized-dark
public static function get_instance( $post_id ) {
  global $wpdb;

サポートされている言語

ココで確認出来ます。

執筆時バージョン

0.9.14

JetpackのMarkdownとの相性がいまいちなので、今は使っていません。

タイトルとURLをコピーしました