繁体   English   中英

在wordpress中的php中使用简码

[英]Using shortcodes in php in wordpress

我试图在wordpress的php模板中使用简码,并且无法使用以下代码。 请帮忙:

<?php
 $args = array('post_type' => 'package', 'package-category' => 'South Africa',     'posts_per_page' => 6);
 $loop = new WP_Query($args);
 while($loop->have_posts()) : $loop->the_post();

$thumbnail = get_the_post_thumbnail();

$mc_content = <<<MCC
<div class="four columns gdl-package-grid2">
    <div class="package-content-wrapper">
        $thumbnail
    </div>
</div>
MCC;


echo do_shortcode('[tab_item title="ITEM_TITLE"]' .$mc_content. '[/tab_item]');



endwhile;
?>

你尝试过这个吗?

这可能会有所帮助。

echo do_shortcode('[tab_item title="ITEM_TITLE"]' .addslashes($mc_content). '[/tab_item]');

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM