vendredi 18 mars 2016

Wrapping an existing shortcode with a new one

I am writing a wordpress plugin that extends an existing plugin's behavior.

The existing plugin defines a shortcode named [original] and I define a shortcode named [wrapper] that adds some functionality, but basically behaves the same.

This is the code I wrote:

function wrapper_shortcode($atts,$content)
{
    //Do something...
    return do_shortcode("[original]$content[/original]");
}
add_shortcode( 'wrapper', 'wrapper_shortcode' );

My question is, how do I pass the attributes ($atts) next to the [original] shortcode, and is there a better way to do this than to call the do_shortcode() function ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire