0

I need to add attribute "rel" to vc_btn.

When i add to functions.php

 $attributes = array(
     'type' => 'textfield',
     'heading' => "rel nofollow",
     'param_name' => 'element_rel',
     'value' => '',
     'description' => 'Add nofollow?'
    );

    vc_add_param( 'vc_btn', $attributes );

It shows when i edit button (backend). But nothing happens on page (front). vc_btn is loaded as one of the elements by Grid Post. I have tried to copy vc_btn.php from /include/templates/shortcodes/ to created dir /vc_templates/ in theme directory. I have tried this, but nothing: How do I add an HTML attribute to row (WP Bakery Visual Composer)?

Problem is that when Grid Post load content it is not using vc_btn.phg from /include/templates/shortcodes/vc_btn.php (or my_theme/vc_templates/vc_btn.php ) but from /include/templates/params/vc_grid_item/attributes/vc_btn.php

Thans for any help

Community
  • 1
  • 1
kadet
  • 1
  • 1
  • 3

1 Answers1

0

I am not sure if you still need this. but this answer might help someone looking for customizing vc_btn link, class, attribute etc.

Please use the filter vc_gitem_post_data_get_link_real_rel to add attribute "rel" to vc_btn. more filters are available like :

vc_gitem_post_data_get_link_link, vc_gitem_post_data_get_link_target, vc_gitem_post_data_get_link_title

more detail can be found in the plugin file js_composer/include/autoload/params/vc_grid_item.php and function name vc_gitem_create_link_real at line 100

Hope, someone will love it.

Azizul Haque
  • 35
  • 10
  • Yet another year has passed and I ran into a similar issue trying to add a query param to `href` attribute. I already tried to use `add_filter( 'vc_gitem_post_data_get_link_real_link', 'my_callback' )` to functions.php, but my callback is never called - at least no var_dump in frontend. Could you elaborate a bit more? – Seika85 Dec 07 '18 at 15:17