Default WordPress Configurations Built in Theme | Ed Nailor

Default WordPress Configurations Built in Theme

Print Friendly

Using the code below, you can allow your theme to set the default configuration for WP. Useful if you use the same theme as a framework a d do a lot of clean website installs.

function set_theme_defaults() {
$o = array(
 'avatar_default'            => 'blank',
 'avatar_rating'             => 'G',
 'category_base'             => '',
 'comment_max_links'         => 0,
 'comments_per_page'         => 0,
 'date_format'               => 'F j, Y',
 'default_ping_status'       => 'closed',
 'default_post_edit_rows'    => 30,
 'links_updated_date_format' => 'j. F Y, H:i',
 'permalink_structure'       => '/%postname%/',
 'rss_language'              => 'en',
 'timezone_string'           => 'America/New_York',
 'use_smilies'               => 0,
 'page_on_front'             => 2,
 'show_on_front'             => 'page',
 'uploads_use_yearmonth_folders'    => '',
 );

 foreach ( $o as $k => $v )
 {
 update_option($k, $v);
 }

 // Delete dummy post and comment.
 wp_delete_post(1, TRUE);
 wp_delete_comment(1);

 return;
}
register_activation_hook(__FILE__, 'set_theme_defaults');

http://new2wp.com/noob/collection-of-WordPress-and-jquery-code-roundup/



Leave a Reply