最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

shortcode - Run visual composer code in php page

programmeradmin1浏览0评论

I am working on a site built in visual composer/wp bakery. I do not want to work in the admin but in a php file.

How can I get code like

[vc_column_text]
<h3><a href="home">home</a></h3>
[/vc_column_text]

to parse from a a php file, rather than WP admin?

I am working on a site built in visual composer/wp bakery. I do not want to work in the admin but in a php file.

How can I get code like

[vc_column_text]
<h3><a href="home">home</a></h3>
[/vc_column_text]

to parse from a a php file, rather than WP admin?

Share Improve this question asked Mar 26, 2018 at 17:59 JonJon 3652 gold badges8 silver badges24 bronze badges 3
  • Those are shortcodes, it'll make more sense and be much easier to search if you think of them as VC shortcodes rather than VC code – Tom J Nowell Commented Mar 26, 2018 at 18:05
  • Why use Visual Composer at all if you want to write the code? Seems to defeat the purpose. – Jacob Peattie Commented Mar 27, 2018 at 0:10
  • because the site is written in visual composer. I am just working with it. If I deactivate the plugin it does not make HTML code but errors. – Jon Commented Mar 27, 2018 at 8:04
Add a comment  | 

2 Answers 2

Reset to default 8

Based on Toms comment this will work:

<?php echo do_shortcode( ' 
[vc_column_text]
<h3><a href="home">home</a></h3>
[/vc_column_text]
' );?>

You can just try this function WPBMap::addAllMappedShortcodes(); and the shortcodes will disappear!

发布评论

评论列表(0)

  1. 暂无评论