Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm setting up a theme options page, I used it on a previous theme and thought i could easily just copy it over to the new one.

<?php $options = get_option( 'sample_theme_options' ); ?>
<?php echo $options['introtext'] ?>

this is my functions file

<?php 

add_action( 'admin_init', 'theme_options_init' );
add_action( 'admin_menu', 'theme_options_add_page' ); 

function theme_options_init(){
 register_setting( 'sample_options', 'sample_theme_options');
} 

function theme_options_add_page() {
 add_theme_page( __( 'TriState', 'TriState Options' ), __( 'TriState', 'TriState Options' ), 'edit_theme_options', 'theme_options', 'theme_options_do_page' );
} 
function theme_options_do_page() { global $select_options; if ( ! isset( $_REQUEST['settings-updated'] ) ) $_REQUEST['settings-updated'] = false; ?>
<div>
<?php screen_icon(); echo "<h2>". __( 'TriState Theme Options', 'TriState' ) . "</h2>"; ?>
<?php if ( false !== $_REQUEST['settings-updated'] ) : ?>
<div>
<p><strong><?php _e( 'Options saved', 'TriState' ); ?></strong></p></div>
<?php endif; ?> 
<form method="post" action="options.php">
<?php settings_fields( 'sample_options' ); ?>  

<?php $options = get_option( 'sample_theme_options' ); ?> 
<table>
<tr valign="top"><td>
<?php @readfile("http://www.kevinmonahan.com/news.htm"); ?>
</td>
</tr>
<tr valign="top"><th scope="row">
<?php _e( 'Picture', 'TriState' ); ?></th>
<td>
<input id="sample_theme_options[picture]" class="large-text" cols="50" rows="1" name="sample_theme_options[picture]" value="<?php esc_attr_e( $options['picture'] ); ?>" />
<label for="sample_theme_options[sometext]"><?php _e( 'Add the full url to the image you would like at the top', 'TriState' ); ?></label><br /><br /><br /> </td>
</tr> 
<tr valign="top"><th scope="row">
<?php _e( 'Twitter Handle', 'TriState' ); ?></th>
<td>
<input id="sample_theme_options[twiturl]" class="large-text" cols="50" rows="1" name="sample_theme_options[twiturl]" value="<?php esc_attr_e( $options['twiturl'] ); ?>" />
<label for="sample_theme_options[sometext]"><?php _e( 'http://twitter.com/yourprofileurl', 'TriState' ); ?></label><br /><br /><br /> </td>
</tr> 
<tr valign="top"><th scope="row"><?php _e( 'Intro Heading', 'TriState' ); ?></th>
<td>
<textarea id="sample_theme_options[introtext]"
class="large-text" cols="50" rows="1" name="sample_theme_options[introtext]"><?php echo esc_textarea( $options['introtext'] ); ?></textarea>
<label for="sample_theme_options[sometext]"><?php _e( 'This is the large text area at the top of the page. A quick description of yourself is best!', 'TriState' ); ?></label><br /><br /><br />
</td>
</tr>
<tr valign="top"><th scope="row"><?php _e( 'Intro Subheading', 'TriState' ); ?></th>
<td>
<textarea id="sample_theme_options[introsub]"
class="large-text" cols="50" rows="1" name="sample_theme_options[introsub]"><?php echo esc_textarea( $options['introsub'] ); ?></textarea>
<label for="sample_theme_options[sometext]"><?php _e( 'This is smaller text under the heading. Same idea make it short and sweet!', 'TriState' ); ?></label><br /><br /><br />
</td>
</tr>
<tr valign="top"><th scope="row"><?php _e( 'Quick Text - Left', 'TriState' ); ?></th>
<td>
<textarea id="sample_theme_options[leftquick]"
class="large-text" cols="50" rows="1" name="sample_theme_options[leftquick]"><?php echo esc_textarea( $options['leftquick'] ); ?></textarea>
<label for="sample_theme_options[sometext]"><?php _e( 'This is a quick heading for the left side. It can be any length.', 'TriState' ); ?></label><br /><br /><br />
</td>
</tr>
</table> 
<p>
<input type="submit" value="<?php _e( 'Save Options', 'TriState' ); ?>" />
</p>
</form>
</div>
<?php } ?>
share|improve this question
    
And what is the question? –  s_ha_dum Dec 6 '13 at 4:59
    
@s_ha_dum i just realized i never asked.... my call isnt working in my index.php –  OneEightLeft Dec 6 '13 at 17:19
    
This code works for me –  s_ha_dum Dec 6 '13 at 18:38
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.