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();
- $twitch = $social_accounts['twitch'] ?? '';
- return array_merge(
- $social_fields,
- array(
- "twitch" => array(
- 'label' => __('Twitch', 'wc-frontend-manager') ,
- 'type' => 'text',
- 'class' => 'wcfm-text wcfm_ele',
- 'label_class' => 'wcfm_title wcfm_ele',
- 'value' => $twitch,
- 'placeholder' => __('Twitch Handler', 'wc-frontend-manager')
- )
- )
- );
- }, 10, 2);
- add_filter('wcfm_profile_social_types', function($types) {
- return array_merge(
- $types,
- ['twitch' => 'twitch',]
- );
- });
- add_action('wcfmmp_store_after_social', function($vendor_id) {
- ?>
- <style>
- .store-twitch-logo{
- display: block;
- margin-top: 50%;
- transform: translateY(-50%);
- }
- .store-twitch-logo svg {
- display: block;
- margin: 0 auto;
- width: 15px;
- }
- .store-twitch-logo svg path {
- fill: #17a2b8;
- }
- #wcfmmp-store .social_area ul li:hover .store-twitch-logo svg path {
- fill: #fff;
- }
- </style>
- <?php
- $store_info = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true );
- if( isset( $store_info['social']['twitch'] ) && !empty( $store_info['social']['twitch'] ) ) { ?>
- <li><a href="<?php echo wcfmmp_generate_social_url( $store_info['social']['twitch'], 'twitch' ); ?>" class="store-twitch-logo" target="_blank">
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M2.149 0l-1.612 4.119v16.836h5.731v3.045h3.224l3.045-3.045h4.657l6.269-6.269v-14.686h-21.314zm19.164 13.612l-3.582 3.582h-5.731l-3.045 3.045v-3.045h-4.836v-15.045h17.194v11.463zm-3.582-7.343v6.262h-2.149v-6.262h2.149zm-5.731 0v6.262h-2.149v-6.262h2.149z" fill-rule="evenodd" clip-rule="evenodd"/></svg>
- </a></li>
- <?php }
- });
- add_filter('wcfm_social_url', function($social_handle, $social) {
- if( $social == 'twitch' && strpos( $social_handle, 'twitch' ) === false) {
- $social_handle = 'https://www.twitch.tv/' . $social_handle;
- }
- return $social_handle;
- }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement