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
//all of this replaces line 147 (NOT 149!!) | |
$db_conn_uri = $dbhost; | |
if(isset($dbport) && !empty($dbport)){ | |
$db_conn_uri .= ":" . $dbport;//could be improved by adding a check to make sure that $dbport doesn't start with ":" before tagging that on for them | |
} | |
$cn = @mysql_pconnect($db_conn_uri, $dbuser, $dbpasswd); |
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
//you can have as many of these as you want... | |
your_prefix_register_field('field_id', 'field label', 'dashboard page', 'section_id', array('callback', 'params', 'can', 'go', 'here')); | |
your_prefix_register_field('field_id2', 'field label', 'dashboard page', 'section_id'); | |
your_prefix_register_field('field_id3', 'field label', 'dashboard page', 'section_id'); | |
your_prefix_register_field('field_ida', 'field label', 'dashboard page', 'section_id'); | |
your_prefix_register_field('field_idz', 'field label', 'dashboard page', 'section_id'); |
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
con_register_section('section_id', 'Visible Name To User'); |
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
function your_global_callback($field){ | |
$selected = get_option($field["id"]); | |
if($field["type"] == "text"){ | |
?> | |
<input type="text" name="<?php echo $field["id"]; ?>" id="<?php echo $field["id"]; ?>" value="<?php echo $selected ?>"> | |
<?php | |
}else if($field["type"] == "checkbox"){ | |
if($selected){ | |
$selText = ' checked="checked" '; |
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
function your_prefix_register_field($id, $name, $section, $type, $filter = NULL){ | |
add_settings_field($id, | |
$name, | |
"your_global_callback", | |
'media', | |
'your_prefix_' . $section, | |
array("id" => $id, | |
"name" => $name, | |
"type" => $type) | |
); |
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
function your_prefix_your_section_callback_function(){ | |
settings_fields('your_settings_group');//make hidden fields print out in form | |
echo "<p>Stuff for the user here</p>"; | |
} |
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
function con_register_section($section, $title){ | |
add_settings_section('your_prefix_' . $section, | |
$title, | |
'your_prefix_'.$section.'_callback_function', | |
'dashboard page'); | |
} |
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
function your_init_function(){ | |
//you will add stuff here later | |
} |
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
add_action('admin_init', 'your_init_function'); |
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
$thumb_sizes = array( | |
'breaking' => array( 'breaking', 80, 80, true ), | |
'slider1' => array( 'slider1', 390, 280, true ), | |
'slider1-wide' => array( 'slider1-wide', 450, 320, true ), | |
'slider1-thumbnail' => array( 'slider1-thumbnail', 120, 72, true ), | |
'slider2' => array( 'slider2', 710, 385, true ), | |
'slider2-wide' => array( 'slider2-wide', 880, 385, true ), | |
'slider3' => array( 'slider3', 455, 430, true ), | |
'slider3-wide' => array( 'slider3-wide', 630, 430, true ), |