是否可以通过Redux框架更新WordPress博客名称和博客描述。
array(
'id' => 'blogdescription',
'type' => 'text',
'title' => 'Blog Description',
'default' => '',
),
是否可以通过Redux框架更新WordPress博客名称和博客描述。
array(
'id' => 'blogdescription',
'type' => 'text',
'title' => 'Blog Description',
'default' => '',
),
update_option('blogname', '新值');
update_option('blogdescription', '新值');
挂载在管理界面上。add_action('admin_init', 'update_my_site_blog_info');
function update_my_site_blog_info() {
$old = get_option('blogdescription');
$new = 'New Site Title';
if ( $old !== $new ) {
update_option( 'blogdescription', $new );
}
}
add_filter('redux/options/[your_opt_name]/compiler', 'update_my_site_blog_info');
function update_my_site_blog_info() {
$new = 'New Site Title';
update_option( 'blogdescription', $new );
}
array(
'id' => 'blogdescription',
'type' => 'text',
'title' => 'Blog Description',
'default' => '',
'compiler' => true,
),
add_action('init', 'update_my_site_blog_info');
function update_my_site_blog_info()
{
global $opt_keyname;
$check = array('blogdescription', 'blogname');
foreach($check as $key)
{
if ( get_option($key) != $opt_keyname[$key] )
{
update_option( $key, $opt_keyname[$key] );
}
}
}
Redux::setSection( $opt_name,
array(
'title' => 'Basic Settings',
'id' => 'basic_settings',
'fields' => array(
array(
'id' => 'blogname',
'type' => 'text',
'title' => 'Blog Title',
'default' => get_option( 'blogname' )
),
array(
'id' => 'blogdescription',
'type' => 'text',
'title' => 'Blog Description',
'default' => get_option( 'blogdescription' )
),
)
)
);