Skip to content

Instantly share code, notes, and snippets.

@flowtwo
Created October 11, 2013 18:39
Show Gist options
  • Save flowtwo/6939840 to your computer and use it in GitHub Desktop.
Save flowtwo/6939840 to your computer and use it in GitHub Desktop.
This sets standard settings on theme activation
/*
* Get standard settings upon installation
*/
function gr_set_defaults(){
$o = array(
'avatar_default' => 'blank',
'avatar_rating' => 'G',
'category_base' => '',
'comment_max_links' => 0,
'comment_whitelist' => 0,
'close_comments_for_old_posts' => 1,
'close_comments_days_old' => 90,
'page_comments' => 1,
'comments_per_page' => 10,
'default_comments_page' => 'newest',
'comment_order' => 'asc',
'blogdescription' => '',
'date_format' => 'j. F Y',
'date_format_custom' => 'j. F Y',
'time_format' => 'H:i',
'time_format_custom' => 'H:i',
'default_ping_status' => 'closed',
'default_pingback_flag' => 1,
'default_post_edit_rows' => 50,
'links_updated_date_format' => 'j. F Y, H:i',
'permalink_structure' => '/%postname%/',
'timezone_string' => 'Europe/Copenhagen',
'use_smilies' => 0,
);
foreach ( $o as $k => $v ) {
update_option($k, $v);
}
wp_update_term(1, 'category', array(
'name' => __('News','green'),
'slug' => 'news'
));
wp_delete_post(1, TRUE);
wp_delete_comment(1);
return;
}
add_action( 'after_switch_theme', 'gr_set_defaults' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment