1

I have a page with a theme that integrates WPBakery Page Builder. The theme creates a single page layout by adding together different pages.

The single pages itself have some custom design options, e.g. row paddings, margins, background-image, etc. If I open one page alone, I can see the custom css applied.

But in the one-page-layout, those custom design options are not applied. From the HTML I can see that the custom CSS that is generated in the single page is not generated in the one-page-layout (which consists of multiple pages).

My idea is to tweak the theme and manually add the CSS - but it has been months since I worked with Wordpress programatically, so I hope someone can give me a hint. How can I programatically get the CSS code that WPBakery creates for a page's design options? Somewhere in WPBakery, it must take the design options stored in the shortcodes and add it to the head.

I hope the problem is understandable :-)

Matthias S
  • 3,358
  • 3
  • 21
  • 31
  • It is expected that you at least attempt to code this for yourself. I would suggest that you do some additional research, either via Google or by searching SO then make an attempt. If you still have trouble, please come back with your code and explain what you have tried in the body of the original question. – Justin R. Aug 07 '18 at 23:17
  • I was looking in the theme and plugin code, and looked through the WPBakery Knowledge Base, but I was unable to find it :/ but it's true, I shouldnt come here just to ask for a solution. – Matthias S Aug 08 '18 at 08:29

1 Answers1

4

The css is in the meta _wpb_shortcodes_custom_css.

I used this to solve a similar issue :

<style type="text/css" data-type="vc_shortcodes-custom-css"><?php echo get_post_meta( 17250, '_wpb_shortcodes_custom_css', true ); ?></style>
shagshag
  • 461
  • 3
  • 9
  • would add that if that particular page has custom CSS defined in visual composer, that custom CSS is stored in the meta _wpb_post_custom_css. So for completeness you should echo that post meta too. – Flo May 29 '22 at 22:36