I’m using the Options Framework Theme to put together an options page. The user(s) I’m building this for would like to be able to edit a few settings directly from this page, including of which – the Site Title and Tagline.
Concept:
Options.php:
$options[] = array(
'name' => __('Site Title', 'options_framework_theme'),
'desc' => __('The name of your site.', 'options_framework_theme'),
'id' => 'title',
'std' => 'PHP CODE FOR SITE TITLE HERE ...',
'class' => 'medium',
'type' => 'text');
Is there a way to do this (add their own Site Title and Taglines) within a text-field for example, click the Save Options button to output it to the front-end of the site and display an updated version in the WP API Settings > General Settings sub-menu page?
The framework offers a filter for validating input values inside the
optionsframework_validate
function.Just for reference, here’s the relevant part from the file
wp-content/themes/your-theme/inc/options-framework.php
:So, considering that we have the following options in the file
wp-content/themes/your-theme/options.php
:And in
wp-content/themes/your-theme/functions.php
, we filter thetext
input type (of_sanitize_
+text
) and if it matches our defined ids (blogname
andblogdescription
, just like in General Settings), it will update the site options that have the same id.Please note, that this doesn’t work the other way around: changes made in
Settings -> General
won’t be reflected inside the theme options page…