Shortcodes come in two flavors:
[shortcodename param1 = value, ..., param-n = value]
and
[shortcodename param-1 = value, ..., param-n = value]some content[/shortcodename]
In both cases, add_shortcode('shortcodename', 'functionname')
function is identical.
The functionname()
function’s parameters, determine which flavor will be used:
functionname($atts)
is for shortcode with no closing tag, and
functionname($atts, $content)
is for shortcode with an arbitrary content, between opening, and closing tags.
In our case, the second type should be used:
function my_block_header($atts, $content) {
return '<div class="block_header">' . $content . '</div>';
}
add_shortcode('blockhead', 'my_block_header');
Use as:
<blockquote>
[blockhead]Headline text[/blockhead]
... quoted text ...
</blockquote>
Note: second add_shortcode
, in your code is unnecessary, and incorrect, as shortcode tag cannot start with /
character, and one shortcode is enough, to return a division, with both, opening, closing tags. Also, both shortcode functions, in your code, lack mandatory parameters.