Extend Visual Composer's default shortcodes or create your own shortcode?

wordpress

#1

Hi, Themeforest Auhtors.

I’m creating my own Wordpress theme. And i’m using Visual Composer as a Page Builder for my theme.
My theme will be support some my own extra shortcodes. And also, i want to extend some functionality of default Visual Composer shortcodes.

For example: default Empty Space shortcode have params:

  • Height
  • Extra class name

And i want to add visibility param, where user can define visibility option for current element.( eg, visible on desktop only, or hidden on phones ), so my own Empty Space shortcode will looks like:

  • Height
  • Visibility
  • Extra class name

I’ve completely learned Visual Composer documentation. And figured out 2 ways to do what i want:

  1. Remove default Visual Composer’s elements using vc_remove_element().
    Then, add my own shortcodes with custom name and needed params via vc_map() function.
  2. Do not remove default Visual Composer’s elements, and just add new params via vc_add_param() to shortcodes which i want to extend

So, I have a question:
What the best practice to extend functionality of default Visual Composer shortcodes, and why?
Cheers!


#2

If I’m not wrong, this needs to copy VC template in theme folder (vc_templates).
Whenever plugin is updated for these templates, needs to re-edit theme in theme too (not always, but many times as plugin keeps posting updates).

As per me, better way is to create own shortcode where-ever possible with minimum use of vc_add_param().


#3

Yes, you are right.

If in the future the default shortcode will be updated in plugin with some extra params, i will update theme’s vc_templates folder.

Just why I asked myself this question. My potential customer (theme buyer in future) may already have experience with Visual Composer and may have previously filled pages usingVisual Composer.

So, if i will choose now way #1: [quote=“vburlak, post:1, topic:17967”]
Remove default Visual Composer’s elements using vc_remove_element(). Then, add my own shortcodes with custom name and needed params via vc_map() function.
[/quote]

After transfering previously filled pages content via Visual Composer from customer’s previously filled site(or just after switching theme), customer will be need to fill his content in my own shortcodes. And it is not always convenient. Especially when I extend the functionality of default shortcodes with minor params(like a visibility, extra animation or something else that does not require creating of a separate shortcode)

Anyway, thx for reply.


#4

Just missed follow up :slightly_smiling:

Don’t worry about if buyer has pages created previously or not. They may have content from other themes shortcodes too. Whenever someone re-design site, some work is unavoidable and he is prepared for that. You cannot full fill needs of everyone :slightly_smiling:

Always consider, you sell theme not plugin.
Yes, from experience, keep minimum dependency on plugin. This will be helpful in long run, when no one buys theme, but we still need to keep it supported for nothing :wink:
Keeping up with plugin changes is hard when time pass on. And buyers need latest versions of plugin always :wink: