disabled() - WordPress 函数参考中文文档

返回介绍

disabled()

发布于 2017-09-10 字数2641 浏览 869 评论 0

disabled( mixed $disabled,  mixed $current = true,  bool $echo = true )

Outputs the html disabled attribute.


描述

Compares the first two arguments and if identical marks as disabled


参数

$disabled

(mixed)
(Required)
One of the values to compare

$current

(mixed)
(Optional)
(true) The other value to compare if not just true

Default value: true

$echo

(bool)
(Optional)
Whether to echo or just return the string

Default value: true


返回值

(string) html attribute or empty string


源代码

File: wp-includes/general-template.php

function disabled( $disabled, $current = true, $echo = true ) {
	return __checked_selected_helper( $disabled, $current, $echo, 'disabled' );
}

更新日志

Version 描述
3.0.0 Introduced.

相关函数

Uses

  • wp-includes/general-template.php:
    __checked_selected_helper()

Used By

  • wp-admin/includes/class-walker-category-checklist.php:
    Walker_Category_Checklist::start_el()
  • wp-admin/includes/template.php:
    wp_popular_terms_checklist()
  • wp-admin/includes/media.php:
    image_size_input_fields()
  • wp-admin/includes/meta-boxes.php:
    post_tags_meta_box()
  • wp-admin/includes/nav-menu.php:
    wp_nav_menu_disabled_check()
  • wp-admin/includes/file.php:
    request_filesystem_credentials()
  • Show 1 more used by
    Hide more used by


User Contributed Notes

  1. Skip to note content

    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note

    Contributed by Codex

    Enable/disable text field according to the given value.

    
    <?php $disable_text_field = true; ?>
    <input type="text" <?php disabled( $disable_text_field, true ); ?> name="sample_text_field" />
    

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!