简体   繁体   English

WP在说明中显示简码

[英]WP show shortcode in description

I have a problem... I using plugin Display Product for WooCommerce which show products in list view with description. 我有一个问题...我将插件显示产品用于WooCommerce,该产品在带有说明的列表视图中显示产品。 But in these descriptions I have a tables with shortcode [table]...but this tables is not rendered, because description is rendered in raw html format. 但是在这些描述中,我有一个带有简码[table]的表...但是此表未呈现,因为描述是以原始html格式呈现的。

How can I change this line of code to show also content from shortcodes? 如何更改此代码行以显示简短代码的内容?

    if ($excerpt == 'show') {
        $result.= '<p>' . wp_trim_words( get_the_content(), $trimwords ) . '</p>';

You can get the html result of the table shortcode by executing 您可以通过执行以下命令获取表简码的html结果:

$tableHTML = do_shortcode('[table]');

And subsequently append that HTML to the result. 然后将该HTML附加到结果中。

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

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