我有一個複選框,其默認狀態爲未選中:WordPress的設置頁面,如何默認複選框的狀態來檢查?
<?php
function edit_theme_settings() {
if (get_option('sold_text') == true) { $display = 'checked'; }
else { $display = ''; }
update_option('sold_text', $display);
?>
<input type="checkbox" name="sold_text" id="sold_text" <?php echo get_option('sold_text'); ?> />
我想它的默認狀態爲選中第一時間顯示的形式,隨後其「選中」狀態應該由定義get_option( 'sold_text')。
和功能'get_option()'? – 2013-08-04 21:18:48
get_option()呢? – Andy