4

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?

  • 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 Mar 26 '18 at 18:05
  • Why use Visual Composer at all if you want to write the code? Seems to defeat the purpose. – Jacob Peattie Mar 27 '18 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 Mar 27 '18 at 8:04
7

Based on Toms comment this will work:

<?php echo do_shortcode( ' 
[vc_column_text]
<h3><a href="home">home</a></h3>
[/vc_column_text]
' );?>
  • If anyone else is struggling with this, here's a solution that worked for me: wordpress.stackexchange.com/a/230092/9041 – rereradu Apr 17 at 20:35
  • Hey, I am having an issue with the do_shortcode function, I am getting all content of post containing the visual composer shortcode, I have called the function like this:: do_shortcode(get_the_content()) but gives me an output like:: [vc_row][vc_column] content ..... [/vc_row][/vc_column] – Archana Sharma Aug 12 at 6:31
  • I don't want to show these tags with content. – Archana Sharma Aug 12 at 6:32
  • I dont fully understand your case but you need to activate the visual composer/wp bakery plugin in admin, then the [vc_row] will be parsed by that plugin. If you do not want to use the plugin, you have to rewrite all the code – Jon Aug 16 at 9:44
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.