admin管理员组文章数量:1430520
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?
本文标签: plugin developmentIncluding content into an addshortcode() function
版权声明:本文标题:plugin development - Including content into an add_shortcode() function 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745477467a2660025.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论