Skip to content

Instantly share code, notes, and snippets.

@jz5
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jz5/af4442c8ed72a55acdbd to your computer and use it in GitHub Desktop.
Save jz5/af4442c8ed72a55acdbd to your computer and use it in GitHub Desktop.
<?php
// shortcode 処理
// [foo bar="qux" baz="quux"]
add_shortcode('foo', 'rewrite_shortcode_func');
function rewrite_shortcode_func($atts) {
// shortcode のパラメータ取得
extract(shortcode_atts(array(
'bar' => 'qux', // bar 既定値
'baz' => null // baz 既定値
), $atts));
return "(bar = $bar, baz = $baz)"; // shortcode の結果
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment