Div-Wrap with Functions.php in Childtheme using Shortcode!

I simply want to create a Shortcode for a simple styled DIV-Wrapper.

At Sites in WordPress i want to add someting like this:

[quotehead]Headline text[/quotehead]
…a normal blockquote from wordpress…

The Output should be:

<div class=”block_header”>Headline text</div>

My function inside functions.php (in childtheme) has the following content:

/**
* Function block_header_start
**/
function block_header_start()
{
return (‘<div class=”block_header”>’);
}

/**
* Function block_header_end
**/
function block_header_end()
{
return (‘</div>’);
}

add_shortcode(‘blockhead’,’block_header_start’);
add_shortcode(‘/blockhead’,’block_header_end’);

But the output looks like that:

<div class=”block_header”>
<p>&nbsp;</p>
<blockquote>…my content of blockquote…</blockquote>
</div>

Issue: The Words inside the new Wrapper doesn’t appears in Frontend!
Issue: The Wrapper includes the following blockquote, but the closing [/quotehead] is in front of the blockquote in Backend.?!

Is it possible to use only one Shortcode, and wrap the Content that follows, till the end of that line in one function..

Something like the leading # for headers in here or for Markdown files?

Or just the wrapping variant, that works?

Where is my failure?

Read more here:: Div-Wrap with Functions.php in Childtheme using Shortcode!

Leave a Reply

Your email address will not be published. Required fields are marked *