Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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