query("SELECT * from $wpdb->posts WHERE post_title = 'Archives'");
if(!$check) {
$message = "Do not edit this page";
$title_message = 'Archives';
$content = apply_filters('content_save_pre', $message);
$post_title = apply_filters('title_save_pre', $title_message);
$now = current_time('mysql');
$now_gmt = current_time('mysql', 1);
$post_author = $user_ID;
$id_result = $wpdb->get_row("SHOW TABLE STATUS LIKE '$wpdb->posts'");
$post_ID = $id_result->Auto_increment;
$post_name = sanitize_title($post_title, $post_ID);
$ping_status = get_option('default_ping_status');
$comment_status = get_option('default_comment_status');
$postquery ="INSERT INTO $wpdb->posts
(ID, post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent, menu_order)
VALUES
('$post_ID', '$post_author', '$now', '$now_gmt', '$content', '$post_title', '', 'static', '$comment_status', '$ping_status', '', '$post_name', '', '$now', '$now_gmt', '', '')";
$result = $wpdb->query($postquery);
$metaquery = "INSERT INTO $wpdb->postmeta(meta_id, post_id, meta_key, meta_value) VALUES('', '$post_ID', '_wp_page_template', 'page-archives.php')";
$result2 = $wpdb->query($metaquery);
}
}
function delete_archive() {
global $wpdb;
$check = $wpdb->query("SELECT * from $wpdb->posts WHERE post_title = 'Archives'");
if($check) {
$burninate = $wpdb->query("DELETE from $wpdb->posts WHERE post_title = 'Archives' and post_status = 'static'");
$result = $wpdb->query($burninate);
}
}
function setup_archive() {
global $wpdb;
if (file_exists(ABSPATH . 'wp-content/plugins/UltimateTagWarrior/ultimate-tag-warrior-core.php') && in_array('UltimateTagWarrior/ultimate-tag-warrior.php', get_option('active_plugins'))) {
$menu_order="chrono,tags,cats";
} else {
$menu_order="chrono,cats";
}
$initSettings = array(
// we always set the character set from the blog settings
'newest_first' => 0,
'num_entries' => 1,
'num_entries_tagged' => 0,
'num_comments' => 1,
'fade' => 1,
'hide_pingbacks_and_trackbacks' => 1,
'use_default_style' => 1,
'paged_posts' => 1,
'selected_text' => '',
'selected_class' => 'selected',
'comment_text' => '%',
'number_text' => '%',
'number_text_tagged' => '(%)',
'closed_comment_text' => '%',
'day_format' => 'jS',
'error_class' => 'alert',
// allow truncating of titles
'truncate_title_length' => 0,
'truncate_cat_length' => 25,
'truncate_title_text' => '…',
'truncate_title_at_space' => 1,
'abbreviated_month' => 1,
'tag_soup_cut' => 0,
'tag_soup_X' => 0,
// paged posts related stuff
'paged_post_num' => 15,
'paged_post_next' => '« previous 15 posts',
'paged_post_prev' => 'next 15 posts »',
// default text for the tab buttons
'menu_order' => $menu_order,
'menu_month' => 'Chronology',
'menu_cat' => 'Taxonomy',
'menu_tag' => 'Folksonomy',
'before_child' => ' ',
'after_child' => '',
'loading_content' => '
',
'idle_content' => '',
'excluded_categories' => '0');
if (function_exists('af_ela_set_config')) {
$ret = af_ela_set_config($initSettings);
}
return $ret;
}
// if we can't find k2 installed lets go ahead and install all the options that run K2. This should run only one more time for all our existing users, then they will just be getting the upgrade function if it exists.
if (!get_option('k2installed')) {
add_option('k2installed', $current, 'This options simply tells me if K2 has been installed before', $autoload);
add_option('k2aboutblurp', 'This is the about text', 'Allows you to write a small blurp about you and your blog, which will be put on the frontpage', $autoload);
add_option('k2asidescategory', '0', 'A category which will be treated differently from other categories', $autoload);
add_option('k2asidesposition', '0', 'Whether to use inline or sidebar asides', $autoload);
add_option('k2livesearch', 'live', "If you don't trust JavaScript and Ajax, you can turn off LiveSearch. Otherwise I suggest you leave it on", $autoload); // (live & classic)
add_option('k2asidesnumber', '3', 'The number of Asides to show in the Sidebar. Default is 3.', $autoload);
add_option('k2widthtype', 'flexible', "Determines whether to use flexible or fixed width.", $autoload); // (flexible & fixed)
add_option('k2deliciousname', '', 'Makes use of Alexander Malovs Delicious plugin to show the delicious links on the sidebar.', $autoload);
add_option('k2archives', '', 'Set whether K2 has a Live Archive page', $autoload);
add_option('k2scheme', '', 'Choose the Scheme you want K2 to use', $autoload);
add_option('k2livecomments', '0', "If you don't trust JavaScript and Ajax, you can turn off Live Commenting. Otherwise I suggest you leave it on", $autoload);
}
// Here we handle upgrading our users with new options and such. If k2installed is in the DB but the version they are running is lower than our current version, trigger this event.
elseif (get_option('k2installed') < $current) {
/* Do something! */
//add_option('k2upgrade-test', 'this is the text', 'Just testing', $autoload);
}
// Let's add the options page.
add_action ('admin_menu', 'k2menu');
$k2loc = '../themes/' . basename(dirname($file));
function k2menu() {
add_submenu_page('themes.php', 'K2 Options', 'K2 Options', 5, $k2loc . 'functions.php', 'menu');
}
function menu() {
load_plugin_textdomain('k2options');
//this begins the admin page
?>
Help to be had at the K2 Support Forums or in the K2 Documentation.