Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'after_setup_theme', 'child_theme_setup', 20 );
- function child_theme_setup() {
- remove_shortcode( 'vc_contacts' );
- add_shortcode( 'vc_contacts', 'my_contacts' );
- }
- function my_contacts($attributes, $content = null) {
- $attributes = shortcode_atts(
- array(
- 'phone' => '',
- 'email' => '',
- 'address' => '',
- 'layout' => '',
- 'mobile' => '',
- 'website' => ''
- ), $attributes);
- $layout_class = ($attributes['layout'] == 'with_icons')?' with_icons':'';
- $output = '<div class="w-contacts'.$layout_class.'">
- <div class="w-contacts-h">
- <div class="w-contacts-list">';
- if ($attributes['address'] != ''){
- $output .= '<div class="w-contacts-item for_address">
- <i class="fa fa-map-marker"></i>
- <span class="w-contacts-item-name">'.__('Address', 'us').':</span>
- <span class="w-contacts-item-value">'.$attributes['address'].'</span>
- </div>';
- }
- if ($attributes['phone'] != ''){
- $output .= '<div class="w-contacts-item for_phone">
- <i class="fa fa-phone"></i>
- <span class="w-contacts-item-name">'.__('Phone', 'us').':</span>
- <span class="w-contacts-item-value">'.$attributes['phone'].'</span>
- </div>';
- }
- if ($attributes['email'] != ''){
- $output .= '<div class="w-contacts-item for_email">
- <i class="fa fa-envelope"></i>
- <span class="w-contacts-item-name">'.__('Email', 'us').':</span>
- <span class="w-contacts-item-value"><a href="mailto:'.$attributes['email'].'">'.$attributes['email'].'</a></span>
- </div>';
- }
- if ($attributes['mobile'] != ''){
- $output .= '<div class="w-contacts-item for_mobile">
- <i class="fa fa-mobile"></i>
- <span class="w-contacts-item-name">'.__('Mobile', 'us').':</span>
- <span class="w-contacts-item-value"><a href="tel:'.$attributes['mobile'].'">'.$attributes['mobile'].'</a></span>
- </div>';
- }
- if ($attributes['website'] != ''){
- $output .= '<div class="w-contacts-item for_website">
- <i class="fa fa-external-link"></i>
- <span class="w-contacts-item-name">'.__('Website', 'us').':</span>
- <span class="w-contacts-item-value"><a href="'.$attributes['website'].'">'.$attributes['website'].'</a></span>
- </div>';
- }
- $output .= '</div>
- </div>
- </div>';
- return $output;
- }
- add_action('init', function()
- {
- //Get VC gallery shortcode config
- $shortcode_vc_contacts_tmp = WPBMap::getShortCode('vc_contacts');
- //print_r($shortcode_vc_contacts_tmp);
- $shortcode_vc_contacts_tmp['params'][] = array(
- "type" => 'textfield',
- "heading" => __("Mobile", "js_composer"),
- "param_name" => "mobile",
- "description" => "",
- "value" => ""
- );
- $shortcode_vc_contacts_tmp['params'][] = array(
- "type" => 'textfield',
- "heading" => __("Website", "js_composer"),
- "param_name" => "website",
- "description" => "",
- "value" => ""
- );
- //VC doesn't like even the thought of you changing the shortcode base, and errors out, so we unset it.
- unset($shortcode_vc_contacts_tmp['base']);
- //Update the actual parameter
- vc_map_update('vc_contacts', $shortcode_vc_contacts_tmp);
- }, 100);
Advertisement
Add Comment
Please, Sign In to add comment