my_html.php
<?php
global $wp;
$op = get_option( 'mcc_d' );
$post_title = get_the_title();
isset( $this->op['mcc_d_text'] ) ? $mcc_d_text = $this->op['mcc_d_text'] : $mcc_d_text = '';
$html = '<div id="mcc_d_content">';
$html .= 'some content';
$html .= '</div>';
And this is the shortcode.php file:
<?php
if ( ! defined( 'ABSPATH' ) ) {exit;}
include( PLUGIN_PATH . 'parts/my_html.php' );
function mcc_d_shortcode() {
global $html;
return $html;
}
add_shortcode( 'mcc_d_content', 'mcc_d_shortcode');
What doesn't work here is the shortcode output ($html)
, it's empty even when I make $html global (which what I'm trying to avoid)... what am I doing wrong here?