Title: Create external field URL
Last modified: November 3, 2020

---

# Create external field URL

 *  [Threads](https://wordpress.org/support/users/ardits/)
 * (@ardits)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/create-external-field-url/)
 * Hello! I have created an extra field in the General Setting tab of the vendor
   so that they can enter the external web page of their company but I cannot create
   the link so that it opens in a new window.
 * How can I create a field external URL correctly?
 * The store page is created with Elementor and I need to be able to add the shortcode.
   In the created code I use this shortcode but only the web URL is displayed in
   text format and I want it to be a link. [wcfm_store_info data = “store_type”]
 *     ```
       /* WCFM Extra field "Pàgina web" */
       add_filter('wcfm_marketplace_settings_fields_general','wcfm_marketplace_add_custom_field_settings_fields_general',10,2);
       function wcfm_marketplace_add_custom_field_settings_fields_general($fields, $user_id) {
       	$vendor_data = get_user_meta( $user_id, 'wcfmmp_profile_settings', true );
       	$store_type          = isset( $vendor_data['v_store_type'] ) ? esc_attr( $vendor_data['v_store_type'] ) : '';
       	if(isset($fields['store_name'])) {
       	$fields = array_slice($fields, 0, 3, true) +
       	array("v_store_type" => array('label' => __('Pàgina web', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $store_type )) +
       																	array_slice($fields, 3, count($fields) - 3, true) ;
       	}
       	return $fields;
       }
       add_action( 'wcfm_wcfmmp_settings_update','fn_wcfm_vendor_settings_storetype_update', 30, 2);
       add_action( 'wcfm_vendor_settings_update','fn_wcfm_vendor_settings_storetype_update', 30, 2);
       function fn_wcfm_vendor_settings_storetype_update($user_id, $wcfm_settings_form ){	
       	$wcfm_settings_form_data_new = array();
       	parse_str($_POST['wcfm_settings_form'], $wcfm_settings_form_data_new);	
       	$wcfm_settings_form_data_storetype = array();
       	if(isset($wcfm_settings_form_data_new['v_store_type']) && !empty($wcfm_settings_form_data_new['v_store_type'])) {
       		$wcfm_settings_form_data_storetype['v_store_type'] = $wcfm_settings_form_data_new['v_store_type'];
       	}
       	$wcfm_settings_form = array_merge( $wcfm_settings_form, $wcfm_settings_form_data_storetype );
       	update_user_meta( $user_id, 'wcfmmp_profile_settings', $wcfm_settings_form );
       }
   
       add_filter('wcfmmp_additional_store_info','vendor_store_type_wcfmmp_additional_store_info',10,3);
       function vendor_store_type_wcfmmp_additional_store_info($data_value, $data_info, $store_id) {
       	$vendor_data = get_user_meta( $store_id, 'wcfmmp_profile_settings', true );
       	$store_type          = isset( $vendor_data['v_store_type'] ) ? esc_attr( $vendor_data['v_store_type'] ) : '';
       	if($data_info == 'store_type') {
       		$data_value = '<p>'.$store_type.'</p>';
       	}	
       	return $data_value;
       }
       ```
   
 * thanks

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [WC Lovers](https://wordpress.org/support/users/wclovers/)
 * (@wclovers)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/create-external-field-url/#post-13632240)
 * Add this snippet to your site as well-
 *     ```
       add_filter( 'wcfmmp_additional_store_info', function( $data_value, $data_info, $store_id ) {
       	if( $data_info == 'store_type' ) {
       		$data_value = '<a target="_blank" href="'.$data_value.'">'.$data_value.'</a>';
       	}
       	return $data_value;
       }, 50, 3 );
       ```
   
 *  Thread Starter [Threads](https://wordpress.org/support/users/ardits/)
 * (@ardits)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/create-external-field-url/#post-13632634)
 * Hi, thanks for the code but it just doesn’t work properly.
 * The shortcode [wcfm_store_info data = “store_type”] is displayed incorrectly 
   as you can see here: [https://ibb.co/5sp0VN7](https://ibb.co/5sp0VN7)
 * If we click on the link the URL is displayed incorrectly: [https://mywebsite.com/liststores/namestore/<p>www.webiste.com](https://mywebsite.com/liststores/namestore/<p>www.webiste.com)
   </p>
 * I think it has to do with the first fragment.
 * Thank you again
 *  Thread Starter [Threads](https://wordpress.org/support/users/ardits/)
 * (@ardits)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/create-external-field-url/#post-13666909)
 * Hello?
 *  Plugin Author [WC Lovers](https://wordpress.org/support/users/wclovers/)
 * (@wclovers)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/create-external-field-url/#post-13667029)
 * > $data_value = ‘<p>’.$store_type.'</p>’;
 * Remove this “p” tags from this code. Even you may remove this function. It’s 
   not required.
 * If you want then add such tag at my provided snippet
 *  Thread Starter [Threads](https://wordpress.org/support/users/ardits/)
 * (@ardits)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/create-external-field-url/#post-13667160)
 * I tried to remove <p> but it still doesn’t link correctly to an external URL.
 *     ```
       		$data_value = ''.$store_type.'';
       ```
   
 * Now clicking the website button redirects to:
    [https://mywebsite.com/liststores/namestore/www.website.com](https://mywebsite.com/liststores/namestore/www.website.com)
 * If you look at the website link is at the end of the URL link. I want a new window
   with the external link of the store left over.
    -  This reply was modified 5 years, 6 months ago by [Threads](https://wordpress.org/support/users/ardits/).
 *  Plugin Author [WC Lovers](https://wordpress.org/support/users/wclovers/)
 * (@wclovers)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/create-external-field-url/#post-13671477)
 * Insert website url with “http”.
 *  Thread Starter [Threads](https://wordpress.org/support/users/ardits/)
 * (@ardits)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/create-external-field-url/#post-13671621)
 * OK, now redirect correctly if we add http. How can I do this so that the button
   does not appear in http? now comes out as text [http://website.com](http://website.com).
   Is it possible to put a generic text as a website? thanks

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Create external field URL’ is closed to new replies.

 * ![](https://ps.w.org/wc-frontend-manager/assets/icon-256x256.jpg?rev=1800818)
 * [WCFM - Frontend Manager for WooCommerce](https://wordpress.org/plugins/wc-frontend-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wc-frontend-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wc-frontend-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/wc-frontend-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wc-frontend-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wc-frontend-manager/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [Store page](https://wordpress.org/support/topic-tag/store-page/)

 * 7 replies
 * 2 participants
 * Last reply from: [Threads](https://wordpress.org/support/users/ardits/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/create-external-field-url/#post-13671621)
 * Status: not resolved