下面是一个场景-我想从下拉列表中选择fontawesome图标,但它不起作用。由于某种原因span
不符合要求(我已经试过了jQuery().append()
, CSS)但到目前为止没有运气。任何帮助都将不胜感激。
Code in Page.php
file
<div class="features-block-one">
<div class="icon-one">
<span class="<?php get_theme_mod(\'features_one_icon\' ,\'fa fa-bullseye\');?>"> </span>
</div>
</div>
Code in Customizer file //block one icon
$wp_customize->add_setting(
\'features_one_icon\',
array(
\'default\' => \'fa-fa box\',
\'transport\' => \'postMessage\',
\'sanitize_callback\' => \'sanitize_key\',
)
);
$wp_customize->add_control(
\'features_one_icon_control\',
array(
\'label\' => __(\'Select Icon\', \'text-domain\'),
\'section\' => \'features_block\',
\'type\' => \'select\',
\'settings\' => \'features_one_icon\',
\'choices\' => tar_icons() /*With function tar_icons() I\'m pulling all the icons from the function */
)
);
Code in customizer.js
file
wp.customize( \'features_one_icon\', function( value ) {
value.bind( function( to ) {
$( \'.features-block-one .icon-one span\' ).css( to );
} );
} );