cat_ID] = $wr_cat->cat_name;} $categories_tmp = array_unshift($wr_categories, "Select a category:"); //Access the WordPress Pages via an Array $wr_pages = array(); $wr_pages_obj = get_pages('sort_column=post_parent,menu_order'); foreach ($wr_pages_obj as $wr_page) { $wr_pages[$wr_page->ID] = $wr_page->post_name; } $wr_pages_tmp = array_unshift($wr_pages, "Select a page:"); //Stylesheets Reader $alt_stylesheet_path = TEMPLATEPATH . '/styles/'; $alt_stylesheets = array(); if ( is_dir($alt_stylesheet_path) ) { if ($alt_stylesheet_dir = opendir($alt_stylesheet_path) ) { while ( ($alt_stylesheet_file = readdir($alt_stylesheet_dir)) !== false ) { if(stristr($alt_stylesheet_file, ".css") !== false) { $alt_stylesheets[] = $alt_stylesheet_file; } } } } //Category Combo $category_combo = array(); global $wpdb; $tableWRTermTexonomy = $wpdb->prefix."term_taxonomy"; $tableWRTerms = $wpdb->prefix."terms"; $category_combo[] = ""; $check_category = $wpdb->get_results("SELECT term_id FROM ".$tableWRTermTexonomy." WHERE taxonomy = 'category' AND parent='0'"); foreach($check_category as $term_taxonomy) { $term_taxonomy_id = $term_taxonomy->term_id; $list_category = $wpdb->get_results("SELECT name FROM ".$tableWRTerms." WHERE term_id = '".$term_taxonomy_id."'"); foreach($list_category as $terms) $category_combo[] = $terms->name; } //print_r ($check_category); print_r ($list_category); //exit; //More Options $all_uploads_path = get_bloginfo('home') . '/wp-content/uploads/'; $all_uploads = get_option('wr_uploads'); $other_entries = array("Select a number:","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"); // different fields $options = array(); $options[] = array( "name" => "General Options", "type" => "heading"); $options[] = array( "name" => "Theme Stylesheet", "desc" => "Select your themes alternative color scheme.", "id" => $shortname."_alt_stylesheet", "std" => "default.css", "type" => "select", "options" => $alt_stylesheets); $options[] = array( "name" => "Custom Logo", "desc" => "Upload a logo for your theme, NOTE: pleae take care of Logo size it may disturb the design if uploaded a larger logo then theme logo.. (http://yoursite.com/logo.png)", "id" => $shortname."_logo", "std" => "", "type" => "upload"); $options[] = array( "name" => "Custom Favicon", "desc" => "Upload a 16px x 16px Png/Gif image that will represent your website's favicon.", "id" => $shortname."_custom_favicon", "std" => "", "type" => "upload"); $options[] = array( "name" => "Tracking Code", "desc" => "Paste your Google Analytics (or other) tracking code here.", "id" => $shortname."_google_analytics", "std" => "", "type" => "textarea"); $options[] = array( "name" => "RSS URL", "desc" => "Enter your preferred RSS URL. (Feedburner or other)", "id" => $shortname."_feedburner_url", "std" => "", "type" => "text"); $options[] = array( "name" => "Custom CSS", "desc" => "Add your custom CSS to make some quick chagnes.", "id" => $shortname."_custom_css", "std" => "", "type" => "textarea"); $options[] = array( "name" => "About You Snippet", "desc" => "Include a little snippet about your company / about us that is displayed in the banner/header.", "id" => $shortname."_about", "std" => "", "type" => "textarea"); $options[] = array( "name" => "About You Read More Link", "desc" => "URL of the read more link e.g. http://www.yoursite.com/about", "id" => $shortname."_aboutlink", "std" => "#", "type" => "text"); $options[] = array( "name" => "Customized Homepage", "type" => "heading"); $options[] = array( "name" => "Enable homepage", "desc" => "Check this to use the custom homepage (custom-home.php). To execute it currectly you need to gothrough the following setting for custom home page.", "id" => $shortname."_home", "std" => "false", "type" => "checkbox"); /*$options[] = array( "name" => "Special Category", "desc" => "Select category OR Featured Category you want to define as special category, for homepage", "id" => $shortname."_spl_cat", "std" => "", "type" => "select", "options" => $category_combo); $options[] = array( "name" => "Special Category Post Count", "desc" => "Special Category posts Count or featured category post on home page.", "id" => $shortname."_spl_cat_post_count", "std" => "", "type" => "text");*/ $options[] = array( "name" => "Number of posts", "desc" => "Enter the number of posts you want to display under MyWritings.", "id" => $shortname."_home_posts", "std" => "", "type" => "text"); $options[] = array( "name" => "Archives URl", "desc" => "Enter the URl to archive page template e.g. http://mysite.com/archives/. To make an archive page: Add new page with page template assigned 'Archive Page'.", "id" => $shortname."_home_archives", "std" => "", "type" => "text"); $options[] = array( "name" => "Custom Sidebar Widget", "type" => "heading"); $options[] = array( "name" => "Flickr ID", "desc" => "Enter your Flickr ID here. Use IDGettr to find it.", "id" => $shortname."_home_flickr_user", "std" => "", "type" => "text"); $options[] = array( "name" => "Flickr count", "desc" => "Enter how many flickr photos you want to display. Max 10.", "id" => $shortname."_home_flickr_count", "std" => "", "type" => "text"); $options[] = array( "name" => "Flickr URl", "desc" => "Enter the URl to your flickr account here.", "id" => $shortname."_home_flickr_url", "std" => "", "type" => "text"); /*$options[] = array( "name" => "Disable Tabs?", "desc" => "Check this to disable the sidebar tabs.", "id" => $shortname."_tabs", "std" => "false", "type" => "checkbox");*/ /*$options[] = array( "name" => "Disable Video?", "desc" => "Check this to disable the sidebar video widget.", "id" => $shortname."_video", "std" => "false", "type" => "checkbox"); */ $options[] = array( "name" => "Lifestream posts", "desc" => "Enter the number of posts you want to display under MyLifestream. You must have the Lifestream plugin installed", "id" => $shortname."_home_lifestream", "std" => "", "type" => "text"); $options[] = array( "name" => "Ad Banners", "type" => "heading"); $options[] = array( "name" => "Rotate banners?", "desc" => "Check this to randomly rotate the banner ads.", "id" => $shortname."_ads_rotate", "std" => "true", "type" => "checkbox"); $options[] = array( "name" => "Banner Ad #1 - Image Location", "desc" => "Enter the URL for this banner ad.", "id" => $shortname."_ad_image_1", "std" => "http://wordpressroom.com/ads/wrthemes-125x125-1.gif", "type" => "text"); $options[] = array( "name" => "Banner Ad #1 - Destination", "desc" => "Enter the URL where this banner ad points to.", "id" => $shortname."_ad_url_1", "std" => "http://wordpressroom.com", "type" => "text"); $options[] = array( "name" => "Banner Ad #2 - Image Location", "desc" => "Enter the URL for this banner ad.", "id" => $shortname."_ad_image_2", "std" => "http://wordpressroom.com/ads/wrthemes-125x125-2.gif", "type" => "text"); $options[] = array( "name" => "Banner Ad #2 - Destination", "desc" => "Enter the URL where this banner ad points to.", "id" => $shortname."_ad_url_2", "std" => "http://wordpressroom.com", "type" => "text"); $options[] = array( "name" => "Banner Ad #3 - Image Location", "desc" => "Enter the URL for this banner ad.", "id" => $shortname."_ad_image_3", "std" => "http://wordpressroom.com/ads/wrthemes-125x125-3.gif", "type" => "text"); $options[] = array( "name" => "Banner Ad #3 - Destination", "desc" => "Enter the URL where this banner ad points to.", "id" => $shortname."_ad_url_3", "std" => "http://wordpressroom.com", "type" => "text"); $options[] = array( "name" => "Banner Ad #4 - Image Location", "desc" => "Enter the URL for this banner ad.", "id" => $shortname."_ad_image_4", "std" => "http://wordpressroom.com/ads/wrthemes-125x125-4.gif", "type" => "text"); $options[] = array( "name" => "Banner Ad #4 - Destination", "desc" => "Enter the URL where this banner ad points to.", "id" => $shortname."_ad_url_4", "std" => "http://wordpressroom.com", "type" => "text"); /*$options[] = array( "name" => "Layout Options", "type" => "heading");*/ /*$options[] = array( "name" => "Left Sidebar", "desc" => "Check this to show the sidebar on the left side instead of right.", "id" => $shortname."_mainright", "std" => "false", "type" => "checkbox"); */ /*$options[] = array( "name" => "Category Navigation?", "desc" => "Check this to show categories instead of pages in the top navigation.", "id" => $shortname."_nav", "std" => "false", "type" => "checkbox"); */ update_option('wr_template',$options); update_option('wr_themename',$themename); update_option('wr_shortname',$shortname); update_option('wr_manual',$manualurl); // wr Metabox Options $wr_metaboxes = array( "embed" => array ( "name" => "embed", "default" => "", "label" => "Embed Code", "type" => "text", "desc" => "Paste the embed code for your video here. Video will be resized automatically. Add video as a tag in your post to make your video appear in the sidebar video widget.", "input" => "textarea" ) ); update_option('wr_custom_template',$wr_metaboxes); /* function wr_update_options(){ $options = get_option('wr_template',$options); foreach ($options as $option){ update_option($option['id'],$option['std']); } } function wr_add_options(){ $options = get_option('wr_template',$options); foreach ($options as $option){ update_option($option['id'],$option['std']); } } //add_action('switch_theme', 'wr_update_options'); if(get_option('template') == 'wrframework'){ wr_add_options(); } // end function */ } add_action('init','wr_options'); ?>