1
使用Sage Roots主題我無法從定製程序設置中輸出值。設置/選項顯示在管理員然後我填寫,但不會輸出。Wordpress定製程序輸出值
Customizer.php
function customize_register($wp_customize) {
$wp_customize->add_setting(
'my_label',
array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control(
'my_label',
array(
'label' => 'My Label',
'section' => 'title_tagline',
'settings' => 'my_label',
'transport' => 'postMessage'
)
);
}
add_action('customize_register', __NAMESPACE__ . '\\customize_register');
Customizer.js
(function($) {
wp.customize('my_label', function(value) {
value.bind(function(to) {
$('.my-label').text(to);
});
});
})(jQuery);
HTML
<a href="http://www.example.com" title="My label"><button class="btn btn-primary pull-left my-label" alt="my label" ></button></a>
我在下面找到答案... – roshambo