Last active
April 21, 2016 07:54
-
-
Save tenman/3a2e2b31610936405d2c3db29833f211 to your computer and use it in GitHub Desktop.
example loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function form( $instance ) { | |
$values = array( | |
'name' => array( | |
'gaiyou' => $instance[ 'gaiyou1' ], | |
'gaiyou_name' => $this->get_field_name( 'gaiyou1' ), | |
'gaiyou_id' => $this->get_field_id( 'gaiyou1' ), | |
), | |
'url' => array( | |
'gaiyou' => $instance[ 'gaiyou2' ], | |
'gaiyou_name' => $this->get_field_name( 'gaiyou2' ), | |
'gaiyou_id' => $this->get_field_id( 'gaiyou2' ), | |
), | |
'address' => array( | |
'gaiyou' => $instance[ 'gaiyou3' ], | |
'gaiyou_name' => $this->get_field_name( 'gaiyou3' ), | |
'gaiyou_id' => $this->get_field_id( 'gaiyou3' ), | |
), | |
'tel' => array( | |
'gaiyou' => $instance[ 'gaiyou4' ], | |
'gaiyou_name' => $this->get_field_name( 'gaiyou4' ), | |
'gaiyou_id' => $this->get_field_id( 'gaiyou4' ), | |
), | |
); | |
$html = '<p><label for="%2$s">商号:</label><input class="widefat" id="%2$s" name="%3$s" type="text" value="%1$s"></p>'; | |
foreach ( $values as $key => $val ) { | |
printf( $html, esc_attr( $val['gaiyou'] ), esc_attr( $val['gaiyou_id'] ), esc_attr( $val['gaiyou_name'] ) ); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment