本文所使用到的wp外掛為 WP-CodeBox
貼CODE demo :
public class Hello {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
if ( !function_exists('wp_set_current_user') ) :
/**
* @ignore
*/
function wp_set_current_user($id, $name = '') {
global $current_user;
if ( isset($current_user) && ($id == $current_user->ID) )
return $current_user;
$current_user = new WP_User($id, $name);
return $current_user;
}
endif;
class Example
def example(arg1)
return "Hello: " + arg1.to_s
end
end
以上貼CODE的基本語法:
<pre lang="java" line="1" colla="-">
...
</pre>
<pre> tag 中有幾個參數要說明一下:
(1) lang : 目前支持的語法如下:
abap, actionscript, ada, apache, applescript, asm, asp, autoit, bash, blitzbasic, bnf, c, c_mac, caddcl, cadlisp, cfdg, cfm, cpp-qt, cpp, csharp,css, d, delphi, diff, div, dos, dot, eiffel, fortran, freebasic, genero, gml, groovy, haskell, html4strict, idl, ini, inno, io, java, java5, javascript, latex, lisp, lua, m68k, matlab, mirc, mpasm, mysql, nsis, objc, ocaml-brief, ocaml, oobas,oracle8, pascal, per, perl, php-brief, php, plsql, python, qbasic, rails, reg, robots, ruby, sas, scheme, sdlbasic, smalltalk, smarty, sql, tcl, text, thinbasic, tsql, vb, vbnet, vhdl, visualfoxpro, winbatch, xml, xpp, z80
(2) line : 指定開始行號。不輸入的話,從 1 開始。
要關閉行號顯示的話,請輸入 line="n"
(3) colla : 顯示CODE時要全開、閉合。不輸入的話,預設為全開。
若要預設就關閉 CODE 顯示的話,請輸入 colla="-"