When creating a shortcode as object, this is the class:
class class_shortcode{
function __construct(){
add_shortcode( 'SHORTCODE_NAME', array( $this, 'shortcode_output' ) );
}
function shortcode_output( $atts, $content ) {
// create some output
return $output;
}
}
But there happens to be an external class handling the shortcode output, like this:
class class_shortcode_output{
function shortcode_output(){
// create some output
return $output;
}
}
class class_shortcode{
function __construct(){
$this->display = new class_shortcode_output;
// Then, the shortcode output will be returned by $this->display->shortcode_output()
add_shortcode( 'SHORTCODE_NAME', array( $this, 'display', 'shortcode_output' ) ); <---- THIS IS WHERE I AM STUCK
}
}
So I need the output in within class_shortcode to be handled by $this->display->shortcode_output() from the other class class_shortcode_output. Is it possible?
I am trying these syntaxes:
array( $this, 'display->shortcode_output' )
array( $this, 'display', 'shortcode_output' )
array( $this, array( $this, 'display' ), 'shortcode_output' )
But nothing is working, is it possible to accomplish what I need?