回显提交按钮,提供文本和相应的类。
原型
submit_button( string $text = null, string $type = 'primary', string $name = 'submit', bool $wrap = true, array|string $other_attributes = null )
参数
$text
(string)
(Optional)
按钮的文本(默认为“保存更改”)
$type
(string)
(Optional)
按钮的类型和CSS类。核心价值观包括“主要”,“小”和“大”。
$name
(string)
(Optional)
提交按钮的HTML名称。默认为“提交”。如果下面的$ other_attributes中没有给出id属性,则$ name将用作按钮的id。
$wrap
(bool)
(Optional)
如果输出按钮应包含在段落标记中,则为True,否则为false。默认为true
$other_attributes
(array|string)
(Optional)
应使用按钮输出的其他属性,将属性映射到其值,例如将tabindex设置为1等。这些键/值属性对将作为attribute =“value”输出,其中attribute是键。其他属性也可以作为字符串提供,例如’tabindex =“1”’,尽管数组格式是首选。
源文件
路径:wp-admin/includes/template.php
<?php
...
function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/submit_button/