first commit
This commit is contained in:
11
vendor/wpcfto/taxonomy_meta/fields/color.php
vendored
Normal file
11
vendor/wpcfto/taxonomy_meta/fields/color.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
function wpcfto_term_meta_field_color($field_key, $value)
|
||||
{
|
||||
?>
|
||||
<div class="wpcfto_image_field">
|
||||
<input type="color"
|
||||
value="<?php echo sanitize_text_field($value); ?>"
|
||||
name="<?php echo esc_attr($field_key) ?>"/>
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
9
vendor/wpcfto/taxonomy_meta/fields/default.php
vendored
Normal file
9
vendor/wpcfto/taxonomy_meta/fields/default.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
function wpcfto_term_meta_field_default($field_key, $value)
|
||||
{ ?>
|
||||
<input type="text"
|
||||
name="<?php echo esc_attr($field_key) ?>"
|
||||
id="<?php echo esc_attr($field_key) ?>"
|
||||
value="<?php echo esc_attr($value); ?>"
|
||||
class="term-meta-text-field"/>
|
||||
<?php }
|
||||
57
vendor/wpcfto/taxonomy_meta/fields/icon.php
vendored
Normal file
57
vendor/wpcfto/taxonomy_meta/fields/icon.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
require_once STM_WPCFTO_PATH . '/helpers/icons.php';
|
||||
|
||||
function wpcfto_term_meta_field_icon($field_key, $value)
|
||||
{
|
||||
?>
|
||||
<div class="wpcfto_image_field">
|
||||
<input type="text"
|
||||
class="wpcfto_font"
|
||||
value="<?php echo sanitize_text_field($value); ?>"
|
||||
name="<?php echo esc_attr($field_key) ?>"/>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
$fa_icons_i = array("");
|
||||
if(function_exists('stm_new_fa_icons')) {
|
||||
$fa_icons = stm_wpcfto_new_fa_icons();
|
||||
foreach ($fa_icons as $icon) {
|
||||
$icons = array_keys($icon);
|
||||
$fa_icons_i[] = $icons[0];
|
||||
}
|
||||
}
|
||||
|
||||
$lr_icons = stm_wpcfto_add_vc_icons_linear(array());
|
||||
$lr_icons = $lr_icons['Linear'];
|
||||
$lr_icons_i = array("");
|
||||
foreach ($lr_icons as $icon) {
|
||||
$icons = array_keys($icon);
|
||||
$lr_icons_i[] = str_replace('lnr-', 'lnricons-', $icons[0]);
|
||||
}
|
||||
|
||||
$icons = apply_filters('wpcfto_iconpicker_sets', array(
|
||||
'FontAwesome' => $fa_icons_i,
|
||||
'Linear' => $lr_icons_i,
|
||||
));
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function ($) {
|
||||
var iconsSearch = icons = <?php echo json_encode($icons); ?>;
|
||||
|
||||
$(document).ready(function () {
|
||||
$('.wpcfto_font').each(function () {
|
||||
$(this).fontIconPicker({
|
||||
source: icons,
|
||||
searchSource: iconsSearch,
|
||||
});
|
||||
});
|
||||
});
|
||||
})(jQuery)
|
||||
</script>
|
||||
<?php }
|
||||
74
vendor/wpcfto/taxonomy_meta/fields/image.php
vendored
Normal file
74
vendor/wpcfto/taxonomy_meta/fields/image.php
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
function wpcfto_term_meta_field_image($field_key, $value)
|
||||
{
|
||||
$img_src = wp_get_attachment_image_url($value, 'full');
|
||||
?>
|
||||
<div class="wpcfto_image_field">
|
||||
<div class="wpcfto_image_field__holder">
|
||||
<img src="<?php echo esc_url($img_src); ?>" />
|
||||
</div>
|
||||
<button class="button button-primary wpcfto_image_field__add">
|
||||
<?php esc_html_e('Add image', 'wp-custom-fields-theme-options'); ?>
|
||||
</button>
|
||||
<button class="button button-secondary wpcfto_image_field__delete">
|
||||
<?php esc_html_e('Delete image', 'wp-custom-fields-theme-options'); ?>
|
||||
</button>
|
||||
<input type="hidden"
|
||||
name="<?php echo esc_attr($field_key) ?>"
|
||||
id="<?php echo esc_attr($field_key) ?>"
|
||||
value="<?php echo esc_attr($value); ?>" />
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function($){
|
||||
var frame;
|
||||
$(document).ready(function(){
|
||||
var $btn = '';
|
||||
$('.wpcfto_image_field__delete').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$btn = $(this);
|
||||
|
||||
var $input = $btn.closest('.wpcfto_image_field').find('input');
|
||||
var $img = $btn.closest('.wpcfto_image_field').find('img');
|
||||
|
||||
$input.val('');
|
||||
$img.attr('src', '');
|
||||
});
|
||||
$('.wpcfto_image_field__add').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
$btn = $(this);
|
||||
if ( frame ) {
|
||||
frame.open();
|
||||
return;
|
||||
}
|
||||
|
||||
frame = wp.media({
|
||||
title: '<?php esc_html_e("Select or Upload Media Of Your Chosen Persuasion", 'wp-custom-fields-theme-options'); ?>',
|
||||
button: {
|
||||
text: '<?php esc_html_e("Use this media", 'wp-custom-fields-theme-options'); ?>'
|
||||
},
|
||||
multiple: false
|
||||
});
|
||||
|
||||
frame.on( 'select', function() {
|
||||
|
||||
// Get media attachment details from the frame state
|
||||
var attachment = frame.state().get('selection').first().toJSON();
|
||||
|
||||
var image_id = attachment.id;
|
||||
var image_url = attachment.url;
|
||||
var $input = $btn.closest('.wpcfto_image_field').find('input');
|
||||
var $img = $btn.closest('.wpcfto_image_field').find('img');
|
||||
|
||||
$input.val(image_id);
|
||||
$img.attr('src', image_url);
|
||||
});
|
||||
|
||||
// Finally, open the modal on click
|
||||
frame.open();
|
||||
|
||||
});
|
||||
});
|
||||
})(jQuery)
|
||||
</script>
|
||||
<?php }
|
||||
Reference in New Issue
Block a user