Fixed select function to work as intended
Showing
1 changed file
with
6 additions
and
2 deletions
| 1 | <?php | 1 | <?php |
| 2 | namespace Tz\WordPress\Tools\HTML; | 2 | namespace Tz\WordPress\Tools\HTML; |
| 3 | 3 | ||
| 4 | function select_opts(Array $options, $selected = null, $echo = true) { | 4 | function select_opts(Array $options, $selected = null, $echo = false) { |
| 5 | $return = ''; | 5 | $return = ''; |
| 6 | 6 | ||
| 7 | foreach ($options as $val => &$label) { | 7 | foreach ($options as $val => &$label) { |
| ... | @@ -15,7 +15,11 @@ function select_opts(Array $options, $selected = null, $echo = true) { | ... | @@ -15,7 +15,11 @@ function select_opts(Array $options, $selected = null, $echo = true) { |
| 15 | } | 15 | } |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | return $return; | 18 | if ($echo) { |
| 19 | echo $return; | ||
| 20 | } else { | ||
| 21 | return $return; | ||
| 22 | } | ||
| 19 | } | 23 | } |
| 20 | 24 | ||
| 21 | function select_opts_provinces($selected = null, $echo = true) { | 25 | function select_opts_provinces($selected = null, $echo = true) { | ... | ... |
-
Please register or sign in to post a comment