Created
August 6, 2014 15:16
-
-
Save atsea/5af186392cfd021c9b1a to your computer and use it in GitHub Desktop.
WordPress: Select list Class
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
class dropdown_category{ | |
public static function getCategory(){ | |
$template_swcategory = array( | |
' '=>"No Category", | |
'Antivirus and Security' => 'Antivirus and Security', | |
'Creativity' => 'Creativity', | |
'Database' => 'Database', | |
'Geographic Info Systems' => 'Geographic Info Systems', | |
'Graphing' => 'Graphing', | |
'Internet and Email' => 'Internet and Email', | |
'Mathematics' => 'Mathematics', | |
'Networking and FTP' => 'Networking and FTP', | |
'Office Productivity' => 'Office Productivity', | |
'Operating Systems and Utilities' => 'Operating Systems and Utilities', | |
'Statistical' => 'Statistical', | |
'Virtualization' => 'Virtualization' | |
); | |
return $template_swcategory; | |
} | |
} | |
/* Paste below in content area */ | |
<select name="sw_category"> | |
<?php | |
foreach ( dropdown_category::getCategory() as $key=>$value){ | |
?> | |
<option value="<?php echo $key; ?>" | |
<?php | |
selected($sw_category, $key); | |
?> | |
><?php echo $value; ?></option> | |
<?php } ?> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment