Skip to content

Instantly share code, notes, and snippets.

@zirosas
Created June 26, 2013 20:51
Show Gist options
  • Save zirosas/5871544 to your computer and use it in GitHub Desktop.
Save zirosas/5871544 to your computer and use it in GitHub Desktop.
WordPress Custom option table
if(strlen($array['option']) > 0) {
$optLen = strlen($array['option']);
$optionBit = $array['option'];
$strSql = "SELECT ".$wpdb->prefix."option . * FROM ".$wpdb->prefix."option ORDER BY ".$wpdb->prefix."option.option_id";
$wpdb->query($strSql);
$options = $wpdb->get_results($strSql,ARRAY_A);
if(count($options) > 0) {
$retNo = 0;
$i = 0;
foreach((array)$options as $option) {
if($i <= $optLen) {
if($optionBit[$i] == '1') {
if($option['display_flg'] == 1)
$strCarOption = $strCarOption . $option['option_name'] . " / ";
}
$i++;
}
}
}
$strOption = substr($strCarOption,0,strlen($strCarOption)-3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment