get_submit_button [ WordPress Function ]
get_submit_button ( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null )
| Parameters: |
|
| Defined at: |
|
Returns a submit button, with provided text and appropriate class
Source
<?php
function get_submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
switch ( $type ) :
case 'primary' :
case 'secondary' :
$class = 'button-' . $type;
break;
case 'delete' :
$class = 'button-secondary delete';
break;
default :
$class = $type; // Custom cases can just pass in the classes they want to be used
endswitch;
$text = ( null == $text ) ? __( 'Save Changes' ) : $text;
// Default the id attribute to $name unless an id was specifically provided in $other_attributes
$id = $name;
if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) {
$id = $other_attributes['id'];
unset( $other_attributes['id'] );
}
$attributes = '';
if ( is_array( $other_attributes ) ) {
foreach ( $other_attributes as $attribute => $value ) {
$attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important
}
} else if ( !empty( $other_attributes ) ) { // Attributes provided as a string
$attributes = $other_attributes;
}
$button = '<input type="submit" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class );
$button .= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />';
if ( $wrap ) {
$button = '<p class="submit">' . $button . '</p>';
}
return $button;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/get submit button « WordPress Codex
Description. Returns a submit button, with provided text and appropriate class. Usage. <?php get_submit_button( $text, $type, $name, $wrap, $other_attributes ) ; ...
codex.wordpress.org - get_submit_button | A HitchHackers guide through WordPress
Feb 24, 2011 ... function get_submit_button( $text = NULL, $type = 'primary', $name = 'submit', $ wrap = true, $other_attributes = NULL ) { switch ( $type ) : case ...
hitchhackerguide.com - WebForm (HttpUnit 1.7 API)
SubmitButton · getSubmitButton(java.lang.String name, java.lang.String value) Returns the submit button defined in this form with the specified name and value.
httpunit.sourceforge.net - get_submit_button (WordPress Function) - WPSeek.com
WordPress lookup for get_submit_button, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com