How to add an extra parameters in Visual Composer

Hello everyone

If you need to add an extra parameter to standard visual composer elements, you can do it in a few steps:

1. First, you need to attache your own function to a visual composer hook your own function, the visual composer hook is – vc_after_init. You need to write a code like this:

add_action( 'vc_after_init', 'vc_after_init_actions' );

Where vc_after_init_actions() must be your function name.

2. Secondly you need to create your function where you will set new parameters for standard elements:

function vc_after_init_actions() { 

    $new_args = array(
      array(
       'type' => 'dropdown',
       'heading' => __( 'Column type', 'js_composer' ),
       'param_name' => 'column_type',
       'value' => array(
         'Content column' => 'content_column',
         'Sidebar_column' => 'sidebar_column',
       ),
       'description' => '',
     )
   );
   vc_add_params('vc_column',$new_args);
}

In the code above I have used standard field settings which you can use in vc_map() function and I added this settings array to standard element settings with vc_add_params() function. After that you add these line codes to your project, you can see your defined field in the settings of a standard element in the admin panel.

Also you can remove fields from element settings with function vc_remove_param(). For example:

 vc_remove_param( 'vc_row', 'full_width' );

How to change recipient email on send event in Contact Form 7 (WordPress)

Hello everyone!

Sometimes you may need to send letter from your form on the your website to another recipient, for example user changed some parameters.

You can change recipient email with this hook:

function wpcf7_param_change_on_send($contact_form) {

    $custom_email = $_POST['some_field'];
    if(!empty($custom_email))
    {
      $mail = $contact_form->prop( 'mail' );
      $mail['recipient'] = $custom_email;
      $contact_form->set_properties(array('mail'=>$mail));
    }
}

add_action("wpcf7_before_send_mail", "wpcf7_param_change_on_send");