Returns a submit button, with provided text and appropriate class
Signature
get_submit_button( $text = null, $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = null )
- text
- (string) The text of the button (defaults to 'Save Changes')
Default:null - type
- (string) The type of button. One of: primary, secondary, delete
Default:'primary large' - name
- (string) The HTML name of the submit button. Defaults to "submit". If no id attribute is given in $other_attributes below, $name will be used as the button's id.
Default:'submit' - wrap
- (boolean) True if the output button should be wrapped in a paragraph tag, false otherwise. Defaults to true
Default:true - other_attributes
- (array|string) Other attributes that should be output with the button, mapping attributes to their values, such as array( 'tabindex' => '1' ). These attributes will be output as attribute="value", such as tabindex="1". Defaults to no other attributes. Other attributes can also be provided as a string such as 'tabindex="1"', though the array format is typically cleaner.
Default:null
Return
(void)
Source
WP Trac GitHub Bitbucketfunction get_submit_button( $text = null, $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = null ) { if ( ! is_array( $type ) ) $type = explode( ' ', $type ); $button_shorthand = array( 'primary', 'small', 'large' ); $classes = array( 'button' ); foreach ( $type as $t ) { if ( 'secondary' === $t || 'button-secondary' === $t ) continue; $classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t; } $class = implode( ' ', array_unique( $classes ) ); if ( 'delete' === $type ) $class = 'button-secondary delete'; $text = $text ? $text : __( 'Save Changes' ); // Default the id attribute to $name unless an id was specifically provided in $other_attributes $id = $name;23 more lines...
Link here
-
URL
http://queryposts.com/function/get_submit_button/ -
HTML
<a href='http://queryposts.com/function/get_submit_button/'>get_submit_button()</a> -
Markdown
[get_submit_button()](http://queryposts.com/function/get_submit_button/) -
BBCode
[url=http://queryposts.com/function/get_submit_button/]get_submit_button()[/url]