Example I want combine shortcode for first paragraph and dropcap.

function st_dropcap( $atts, $content = null ) {
    return '<span class="dropcap">'.$content.'</span>';
add_shortcode('dropcap', 'st_dropcap');

function st_paragraph( $atts, $content = null ) {
    return '<p class="first-paragraph">'.$content.'</p>';
add_shortcode('paragraph', 'st_paragraph');

On post I tried something like this

[paragraph][dropcap]W[/dropcap]elcome to my blog[/paragraph]

Only paragraph is working. How do I combine this code?

Let me know


Change st_paragraph() to this:

function st_paragraph( $atts, $content = null ) {
    return '<p class="first-paragraph">'.do_shortcode($content).'</p>';

See Codex documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.