Created
September 11, 2024 14:46
-
-
Save khoipro/64d5b25c0b457f0ca467f405bf6e5342 to your computer and use it in GitHub Desktop.
Sample extends with a plugin Simple Sticky Contacts (v0.0.6+)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Sample extends with a plugin Simple Sticky Contacts (v0.0.6+) | |
add_action('init', 'codetot_theme_ssc_init', 10); | |
function codetot_theme_ssc_init() { | |
add_filter('ssc_icons', 'codetot_theme_ssc_icons'); | |
add_filter('ssc_get_fields', 'codetot_theme_ssc_fields'); | |
add_filter('ssc_svg_icon_map', 'codetot_theme_ssc_icon_map'); | |
} | |
function codetot_theme_ssc_icons( $items ) { | |
$items['map'] = codetot_theme_ssc_icon_map(); | |
return $items; | |
} | |
function codetot_theme_ssc_fields( $fields ) { | |
return wp_parse_args($fields, [ | |
'map_url' => array( | |
'label' => __( 'Map URL', 'ssc' ), | |
'description' => __('For example: https://google.com/maps/', 'codetot-theme'), | |
'svg_icon' => 'map', | |
'placeholder' => 'https://maps.app.goo.gl/xxx' | |
), | |
'map_text' => array( | |
'label' => __( 'Map Text', 'ssc' ), | |
'description' => __('For example: View on Map', 'codetot-theme') | |
) | |
]); | |
} | |
function codetot_theme_ssc_icon_map() { | |
return '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 7l6 -3l6 3l6 -3v13l-6 3l-6 -3l-6 3v-13" /><path d="M9 4v13" /><path d="M15 7v13" /></svg>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment