selected

函式
selected ( $selected, $current = true, $echo = true )
引數
  • (mixed) $selected One of the values to compare.
    Required:
  • (mixed) $current Optional. The other value to compare if not just true. Default true.
    Required:
    Default: true
  • (bool) $echo Optional. Whether to echo or just return the string. Default true.
    Required:
    Default: true
返回值
  • (string) HTML attribute or empty string.
定義位置
相關方法
checkeddelete_metais_feedis_redirectdelete_metadata
引入
1.0.0
棄用
-

selected: 這是一個WordPress的函式,為一個選擇輸入欄位輸出選擇屬性。它通常被用來標記一個選項為基於條件語句的選擇: 這個函式需要兩個引數:要比較的值和要選擇的值。

輸出HTML選擇屬性。

比較前兩個引數,如果相同則標記為選中。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function selected( $selected, $current = true, $echo = true ) {
return __checked_selected_helper( $selected, $current, $echo, 'selected' );
}
function selected( $selected, $current = true, $echo = true ) { return __checked_selected_helper( $selected, $current, $echo, 'selected' ); }
function selected( $selected, $current = true, $echo = true ) {
	return __checked_selected_helper( $selected, $current, $echo, 'selected' );
}

常見問題

FAQs
檢視更多 >