get_submit_button()获取一个提交按钮

目录

描述

Returns a submit button, with provided text and appropriate class

get_submit_button() 描述

用法

<?php get_submit_button$text$type$name$wrap$other_attributes ); ?>

get_submit_button() 用法

参数

$text

(string) (可选) The text of the button

默认值: Save Changes

$type

(string|array) (可选) The type of button. Common values: primary, secondary, delete.

默认值: primary large

Note: $type can be a single value, or a space separated list of values, or an array of values. The values determine the HTML classes of the button.

  • If $type is 'delete', the classes are 'button delete'.
  • Otherwise the first class is 'button', followed by any of these in order of appearance:
    • type value 'primary' makes class 'button-primary'
    • type value 'small' makes class 'button-small'
    • type value 'large' makes class 'button-large'
    • type value 'secondary' or 'button-secondary' is ignored (the 'button' class has the styling)
    • any other type value 'foo' makes the class 'foo'

For example, the default $type 'primary large' results in a button with HTML classes 'button button-primary button-large'.

$name

(string) (可选) The HTML name of the submit button. If no id attribute is given in $other_attributes below, $name will be used as the button's id.

默认值: submit

$wrap

(boolean) (可选) True if the output button should be wrapped in a paragraph tag, false otherwise. Defaults to true

默认值: true

$other_attributes

(array|string) (可选) Other attributes that should be output with the button. Defaults to no other attributes.

默认值:

get_submit_button() 参数

注意

  • The related function submit_button() echos the button instead of returning it as a string. It has a different default $type, 'primary', resulting in the HTML classes 'button button-primary'.

get_submit_button() 注意

历史

添加于 版本: 3.1

get_submit_button() 历史