• anonymized-13749270

    (@anonymized-13749270)


    Hello WP.org developers!
    first i am so thankful to be able to find help i could not find somewhere else.
    i have a query, i am developing my first wordpress theme and i am working on theme options page.. there i got a textarea for about author snippet which appears below posts. i want to set a default text, like if the user didn’t fill that textarea the default ( if empty ) text would appear.. something like ( go to appearance > theme options and edit this – about you .. )
    any php trick to do it, if empty etc ?
    i have this in functions.php:

    add_settings_field('authorbio', 'Author Biography', 'authorbio_setting', __FILE__, 'homepage_settings');
    .
    .
    .
    function authorbio_setting() {
    $options = get_option('theme_options'); echo "<textarea name='theme_options[authorbio_setting]' rows='8' cols='80'>{$options['authorbio_setting']}</textarea>";
    }

    and i echo info using <?php echo $options['authorbio_setting']; ?>
    best regards. thanks to all !!

The topic ‘theme options php set a default field value if empty’ is closed to new replies.