Visual Composer for WordPress provides many ways to extend its functionality. There are already many add-ons available for this dynamic page builder, but its easy to do the extending yourself, by following the hints in the documentation ;)
In this small tutorial we are adding a “type” field to allow a special css class to be added to each of our row containers.
New Visual Composer element properties can be easily added by using the vc_add_param function. See documentation for more information. In our case we are adding a property to the vc_row element.
By adding the following lines to your themes functions.php, this new property will show in the admin row settings popup.
The new setting will be saved, when you save your document, but you wont see any changes on the frontend yet! Our goal is to switch a css class depending on the type we selected.
Each element within Visual Composer has its own template and these templates can be overruled using your own theme templates. In this case vc_row.php.
The file contents should look something like this:
Now we are adding the magic from the backend to the frontend :) This is how the altered version should look like in your theme folder
We added ‘type’ => ‘in_container’ to the shortcode parameter extraction, with a default setting.
We also added the resulting type to our row wrapper $output .= ‘<div class=”‘.$type.’ ‘.$css_class
Visual Composer allows you to modify any of its elements that way and extend it with your own options or mighty extensions ;) Visual Composer allows some nice custom tweaking, you just need to look a bit closer at the documentation, which is not always that simple to follow :)
Visual composer never was a smart thing. It’s crap, in fact. Why make it so complicated? What’s wrong with the good old CSS? So easy to change any style, layout, etc., with plain CSS. With VC? Waste time and still can’t do what you “Really” want and otherwise could do with plain, straight forward CSS files.
VC is for idiots and poor hackers (fits WP overall purpose)
All depends what your capabilities are. Most people are not comfortable to edit CSS or even dive into SASS / SCSS.
All page builders have their pros and cons. For those that want to tweak things themselves, without getting someone that knows how to, they are a blessing ;)
So they are not for idiots, but for those that have other strengths and rather concentrate on the content. Nobody is forcing you to use a page builder!
Get in touch
I am a full-stack developer. My expertise include:
I love programming, design and know my way around server architecture as well. I would never feel complete, with one of these missing.
I have a broad range of interests, that’s why I constantly dive into new technologies and expand my knowledge where ever required. Technologies are evolving fast and I enjoy using the latest.
Apart from that, I am a peace loving guy who tries to have people around him that think the same. I truly believe in the principle: “If you help someone, someone will help you, when you need it."