Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Change st_paragraph() to this:

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

See Codex documentation.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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