I added some theme options by way of my "functions.php" file. What it does is allow users to upload a photo and write paragraph text which will then be used in the theme. These options are on the dashboard sidebar under the "Appearance" menu item.
I got the photo working great... and even the text works really awesome EXCEPT it's replacing every ' and " with /.
Here is from function.php:
/*** Options ***/
function options_admin_menu() {
// here's where we add our theme options page link to the dashboard sidebar
add_theme_page("Profile Theme Options", "Theme Options", 'edit_themes', basename(__FILE__), 'options_page');
}
add_action('admin_menu', 'options_admin_menu');
function options_page() {
if ( $_POST['update_options'] == 'true' ) { options_update(); } //check options update
?>
<div class="wrap">
<div id="icon-options-general" class="icon32"><br /></div>
<h2>Profile Theme Options</h2>
<form method="post" action="">
<input type="hidden" name="update_options" value="true" />
<table class="form-table">
<tr valign="top">
<th scope="row"><label for="profile_url"><?php _e('Custom profile pic URL:'); ?></label></th>
<td><input type="text" name="profile_url" id="profile_url" size="50" value="<?php echo get_option('profile_url'); ?>"/><br/><span
class="description"> <a href="<?php bloginfo("url"); ?>/wp-admin/media-new.php" target="_blank">Upload your profile pic</a> (max 150px x 150px) using WordPress Media Library and insert its URL here </span><br/><br/><img src="<?php echo (get_option('profile_url')) ? get_option('profile_url') : get_bloginfo('template_url') . '/images/profile.png' ?>"
alt=""/></td>
</tr>
<tr valign="top">
<th scope="row"><label for="sd"><?php _e('Profile Bio:'); ?></label></th>
<td><textarea name="sd" id="sd" cols="48" rows="18"><?php echo get_option('sd'); ?></textarea></td>
</tr>
</table>
<p><input type="submit" value="Save Changes" class="button button-primary" /></p>
</form>
</div>
<?php
}
// Update options
function options_update() {
update_option('logo_url', $_POST['logo_url']);
update_option('sd', $_POST['sd']);
}
Here is what I have in the theme template:
<div class="profile">
<a href="<?php bloginfo('home'); ?>"><img src="<?php echo (get_option('profile_url')) ? get_option('profile_url') : get_bloginfo('template_url') . '/images/profile.png' ?>" alt="<?php bloginfo('name'); ?>"/></a>
</div>
<div class="question">
<span>+Bio</span>
</div>
<div class="answer" style="display: none"><?php echo (get_option('sd')) ? get_option('sd') : get_bloginfo('template_url') ?></div>
Here is the address of the site:
http://rachelforshee.net