WordPress ショートコード

例えば

function highlight_shortcode($class, $content = ”)
{
if($class[‘class’] == ‘html’){
$content = esc_html($content);
}
return ‘

' . $content  . '

‘;
}
add_shortcode(‘highlight’, ‘highlight_shortcode’);
[hightight]

どう?

<h1>Hello</h1>

[highlight class="css"]
.hljs.html::before {
content: ‘HTML’;
background-color: #e44d26;
}
.hljs.xml::before {
content: ‘HTML’;
background-color: #e44d26;
}

なぜ

お問い合わせはこちら