Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('wcfm_profile_fields_social', function($social_fields, $vendor_id) {
- $vendor_data = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true );
- $social_accounts = $vendor_data['social'] ?? array();
- $tiktok = $social_accounts['tiktok'] ?? '';
- return array_merge(
- $social_fields,
- array(
- "tiktok" => array(
- 'label' => __('TikTok', 'wc-frontend-manager') ,
- 'type' => 'text',
- 'class' => 'wcfm-text wcfm_ele',
- 'label_class' => 'wcfm_title wcfm_ele',
- 'value' => $tiktok,
- 'placeholder' => __('TikTok Handler', 'wc-frontend-manager')
- )
- )
- );
- }, 10, 2);
- add_filter('wcfm_profile_social_types', function($types) {
- return array_merge(
- $types,
- ['tiktok' => 'tiktok',]
- );
- });
- add_action('wcfmmp_store_after_social', function($vendor_id) {
- $store_info = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true );
- if( isset( $store_info['social']['tiktok'] ) && !empty( $store_info['social']['tiktok'] ) ) { ?>
- <li><a href="<?php echo wcfmmp_generate_social_url( $store_info['social']['tiktok'], 'tiktok' ); ?>" target="_blank"><i class="wcfmfa fa-link" aria-hidden="true"></i></a></li>
- <?php }
- });
- add_filter('wcfm_social_url', function($social_handle, $social) {
- if( $social == 'tiktok' && strpos( $social_handle, 'tiktok' ) === false) {
- $social_handle = 'https://tiktok.com/' . $social_handle;
- }
- return $social_handle;
- }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement