'0a0a0a', 'text' => 'd8d8cd', 'link' => 'd8d8cd', 'border' => '333333', 'url' => '346BA4', ); break; default: $themecolors = array( 'bg' => 'ffffff', 'text' => '333333', 'link' => '222222', 'border' => 'dddddd', 'url' => '346ba4', ); break; } // gets the page number of the current page function it_the_page_number() { global $paged; // Contains page number. if ( $paged >= 2 ) echo ' | ' . sprintf( __( 'Page %s' , 'inuittypes' ), $paged ); } // loads the intro widget area function inuit_types_intro() { ?>
post_parent ) { $attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') )); foreach ( $attachments as $k => $attachment ) if ( $attachment->ID == $post->ID ) break; $k = $k + 1; if ( isset($attachments[$k]) ) { return get_attachment_link($attachments[$k]->ID); } else { return get_permalink($post->post_parent); } } } endif; // This theme uses post thumbnails add_theme_support( 'post-thumbnails', array( 'post' ) ); set_post_thumbnail_size( 600, 250, true ); add_image_size( 'it-thumbnail', 90, 75, true ); add_image_size( 'one-column-feature', 594, 250, true ); add_image_size( 'two-column-feature', 278, 150, true ); // Add scripts function theme_scripts() { $template_directory = get_template_directory_uri(); wp_enqueue_script( 'suckerfish', "$template_directory/library/js/suckerfish.js" ); } //add_action( 'init', 'theme_scripts' ); // This theme uses wp_nav_menu() // Register nav menu locations register_nav_menus( array( 'primary' => __( 'Primary Navigation', 'inuittypes' ), ) ); // Make theme available for translation // Translations can be filed in the /languages/ directory load_theme_textdomain( 'it', get_template_directory() . '/languages' ); $themename = "Inuit Types"; $shortname = "inuitypes"; $template_path = get_template_directory_uri(); $alt_stylesheet_path = get_template_directory() . '/skins/'; $alt_stylesheets = array(); $frame_path = get_template_directory() . '/frames/'; $frames = array(); $pn_categories_obj = get_categories('hide_empty=0'); $pn_categories = array(); $pne_categories_obj = get_categories('hide_empty=0'); $pne_categories = array(); $pne_pages_obj = get_pages('sort_order=ASC'); $pne_pages = array(); // Alternative Stylesheet Load 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_stylesheet_file = str_replace('.css', '', $alt_stylesheet_file); $alt_stylesheets[] = $alt_stylesheet_file; } } } } // Categories Name Load foreach ($pn_categories_obj as $pn_cat) { $pn_categories[$pn_cat->cat_ID] = $pn_cat->cat_name; } $categories_tmp = array_unshift($pn_categories, "Select a category:"); // Pages Exclude Load /*foreach ($pne_pages_obj as $pne_pag) { $pne_pages[$pne_pag->ID] = $pne_pag->post_title; }*/ // Exclude Pages by Name /*function pages_exclude($options) { $options[] = array( "type" => "wraptop"); $pags = get_pages('sort_order=ASC'); foreach ($pags as $pag) { $options[] = array( "name" => "", "desc" => "", "label" => $pag->post_title, "id" => "pag_exclude_".$pag->ID, "std" => "", "type" => "checkbox"); } $options[] = array( "type" => "wrapbottom"); return $options; }*/ // Custom Page List function get_inc_pages($label) { $include = ''; $counter = 0; $pagsx = get_pages('sort_order=ASC'); foreach ($pagsx as $pag) { $counter++; if ( get_option( $label.$pag->ID ) ) { if ( $counter != 1 ) { $include .= ','; } $include .= $pag->ID; } } return $include; } $other_entries = array("Select a Number:","0","1","2","3","4","5","6","7","8","9","10"); $options[] = array( "name" => __( 'Color scheme', 'it' ), "desc" => "Please select the CSS skin of your blog here.", "id" => $shortname."_alt_stylesheet", "std" => __( 'Select a CSS skin:', 'it' ), "type" => "select", "options" => $alt_stylesheets); $options[] = array( "name" => __( 'Sidebar on the left or right?', 'it' ), "desc" => __( 'Show sidebar content on the left.', 'it' ), "id" => $shortname."_right_sidebar", "std" => "true", "type" => "checkbox"); $options[] = array( "name" => __( 'Featured Post Entries', 'it' ), "desc" => "Select max number of featured entries you wish to appear on homepage. Featured entries are the latest highlighted posts.", "id" => $shortname."_featured_entries", "std" => __( 'Select a Number:' , 'it' ), "type" => "select", "options" => $other_entries); $options[] = array( "name" => __( 'One Column Featured Posts', 'it' ), "desc" => "Show featured posts in one column instead of default two columns", "id" => $shortname."_one_column_featposts", "std" => "false", "type" => "checkbox"); $options[] = array( "name" => __( 'One Column Normal Posts', 'it' ), "desc" => "Show normal posts in one column instead of default two columns", "id" => $shortname."_one_column_posts", "std" => "false", "type" => "checkbox"); $options[] = array( "name" => __( 'Single Post Featured Image', 'it' ), "desc" => "Show a featured image on single posts", "id" => $shortname."_single_post_image", "std" => "false", "type" => "checkbox"); function mytheme_add_admin() { global $themename, $shortname, $options; if ( isset( $_GET['page'] ) && 'theme_options' == $_GET['page'] ) { if ( isset( $_REQUEST['action'] ) && 'save' == $_REQUEST['action'] ) { foreach ($options as $value) { if($value['type'] != 'multicheck'){ if ( isset( $_REQUEST[ $value['id'] ] ) ) update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }else{ foreach($value['options'] as $mc_key => $mc_value){ $up_opt = $value['id'].'_'.$mc_key; if ( isset( $_REQUEST[$up_opt] ) ) update_option($up_opt, $_REQUEST[$up_opt] ); } } } foreach ($options as $value) { if($value['type'] != 'multicheck'){ if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } }else{ foreach($value['options'] as $mc_key => $mc_value){ $up_opt = $value['id'].'_'.$mc_key; if( isset( $_REQUEST[ $up_opt ] ) ) { update_option( $up_opt, $_REQUEST[ $up_opt ] ); } else { delete_option( $up_opt ); } } } } wp_redirect( 'themes.php?page=theme_options&saved=true' ); exit(); } else if ( isset( $_REQUEST['action'] ) && 'reset' == $_REQUEST['action'] ) { foreach ($options as $value) { if($value['type'] != 'multicheck'){ delete_option( $value['id'] ); }else{ foreach($value['options'] as $mc_key => $mc_value){ $del_opt = $value['id'].'_'.$mc_key; delete_option($del_opt); } } } wp_redirect( 'themes.php?page=theme_options&reset=true' ); exit(); } } add_theme_page( __( 'Theme Options' ), __( 'Theme Options' ), 'edit_theme_options', 'theme_options', 'mytheme_admin'); } add_action('admin_menu', 'mytheme_add_admin'); function mytheme_admin() { global $themename, $shortname, $options; if ( isset( $_REQUEST['saved'] ) && $_REQUEST['saved'] ) echo '

'.$themename.' settings saved.

'; if ( isset( $_REQUEST['reset'] ) && $_REQUEST['reset'] ) echo '

'.$themename.' settings reset.

'; ?>

/> 

'Sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array ( 'name' => 'Front Page Intro', 'description' => __('Use a Text Widget in this widget area to add an introduction to your front page' , 'it'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '', 'after_title' => '', ) ); // Comments require_once( dirname( __FILE__ ) . '/library/functions/comments_functions.php'); // Create nice excerpt link for index, search, and archive pages function inuit_types_excerpt( $excerpt, $permalink ) { // remove anchor and strong elements strip_tags( $excerpt, ''); // add permalink $link = '… [' . __( 'Read more…', 'it' ) . ']'; $excerpt = str_replace( ' [...]', $link, $excerpt ); return $excerpt; } /** * Enqueue scripts and styles */ function it_scripts() { global $wp_styles; $stylesheet = get_option( 'inuitypes_alt_stylesheet', '1-default' ); wp_enqueue_style( 'inuittypes', get_stylesheet_uri() ); wp_enqueue_style( 'inuittypes-scheme', get_template_directory_uri() . '/skins/' . $stylesheet . '.css', array( 'inuittypes' ) ); wp_enqueue_style( 'inuittypes-ie', get_template_directory_uri() . '/css/ie.css', array( 'inuittypes' ) ); $wp_styles->add_data( 'inuittypes-ie', 'conditional', 'lte IE 8' ); wp_enqueue_style( 'inuittypes-ie6', get_template_directory_uri() . '/css/ie6.css', array( 'inuittypes' ) ); $wp_styles->add_data( 'inuittypes-ie6', 'conditional', 'lte IE 6' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); } add_action( 'wp_enqueue_scripts', 'it_scripts' ); /** * Filters wp_title to print a neat tag based on what is being viewed. * * @since Inuit Types 1.6 */ function it_wp_title( $title, $sep ) { global $page, $paged; if ( is_feed() ) return $title; // Add the blog name $title .= get_bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title .= " $sep $site_description"; // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) $title .= " $sep " . sprintf( __( 'Page %s', 'it' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'it_wp_title', 10, 2 ); /** * Load Jetpack compatibility file. */ require( get_template_directory() . '/inc/jetpack.compat.php' );