Plugin Directory

Changeset 1396966


Ignore:
Timestamp:
04/16/2016 12:27:21 AM (10 years ago)
Author:
andreyk
Message:

v0.2: add 'class' attr for dropdown; tested up to WP 4.5

Location:
wp-country/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-country/trunk/country.php

    r829314 r1396966  
    55Description: Provides WP_Country PHP class to get countries list as an array and dropdown country select for use in other plugins and themes.
    66Author: Andrey K.
    7 Version: 0.1
     7Version: 0.2
    88Author URI: http://andrey.eto-ya.com/
    99*/
     
    286286            'name' => 'country',
    287287            'id' => '',
     288            'class' => '',
    288289            'selected' => array(),
    289290            'multiple' => false,
     
    324325       
    325326        if ($arr) {
    326             $out .= '<select name="' . $name . ($multiple? '[]" multiple="multiple" ': '" ')
    327                 . ($id ? 'id="' . $id . '" ' : '') . '>';
     327            $out .= '<select name="' . $name . ($multiple? '[]" multiple ': '"')
     328                . ($id ? ' id="' . $id . '" ' : '') . ($class ? ' class="' . $class . '"' : '') . '>';
    328329            foreach ($arr as $key => $value) {
    329                 $out .= '<option value="' . $key. '"'. (in_array($key, $selected) ? ' selected="selected" ' : '') .'>' . $value . '</option>';
     330                $out .= '<option value="' . $key. '"' . (in_array($key, $selected) ? ' selected' : '') . '>' . $value . '</option>';
    330331            }
    331332            $out .= '</select>';
  • wp-country/trunk/readme.txt

    r829317 r1396966  
    55Plugin URI: http://andrey.eto-ya.com/wp-country-plugin
    66Requires at least: 3.6
    7 Tested up to: 3.8
    8 Stable tag: 3.6
     7Tested up to: 4.5
     8Stable tag: 0.2
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4545* *id*: `id` attribute (not displayed by default).
    4646
     47* *class*: `class` attribute of the SELECT tag (empty by default).
     48
    4749* *multiple*: enables multiple select.
    4850
    4951* *selected*: adds the `selected` attribute.
    50 
    5152
    5253== Installation ==
     
    5758== Changelog ==
    5859
     60* 0.2 Add `class` parameter for dropdown list.
    5961* 0.1 Initial version.
    60 
Note: See TracChangeset for help on using the changeset viewer.