mardi 24 février 2015

Replacing Gallery Shortcode with Foundation's Clearing


Using wordpress 4.1 and Foundation 5, and attempting to replace the stock gallery shortcode with foundation's clearing.


In debugging mode, I get a notice of:



Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method foundation_clearing_gallery_replacement::init() should not be called statically in ../wp-includes/plugin.php on line 496



And whenever I save a page/post/etc, only in debugging mode, I get the white screen of death with a "cannot modify header" information on similar line.


The opening of my plugin, which is where I think the problem is manifesting, is:



class foundation_clearing_gallery_replacement {
function __construct(){
add_action( "init", array( __CLASS__, "init" ) );
}

function init(){
remove_shortcode( 'gallery' );
add_shortcode( 'gallery', array( __CLASS__, "gallery_shortcode" ) );
}


With the ending line:



new foundation_clearing_gallery_replacement();


Full source can be seen here





Aucun commentaire:

Enregistrer un commentaire