$default_background_color, ) ); /** * Add Thumbnails support */ if (function_exists('add_theme_support')) { add_theme_support('post-thumbnails'); add_image_size('imaj', 106, 106, true); add_image_size('slider', 980, 179, true); } /** * Register Navigation Menus */ if (function_exists('wp_nav_menu')) { if (function_exists('add_theme_support')) { add_theme_support('nav-menus'); add_action('init', 'register_my_menus'); function register_my_menus() { register_nav_menus(array('top-links'=>__('Top Links'), 'main-menu'=>__('Main Menu'), 'footer-links'=>__('Footer Links'))); } } } add_action('widgets_init', 'theme_widgets_init'); register_widget('Widget_Recent_Avatar_Comments'); add_filter('excerpt_length', 'my_excerpt_length'); add_filter('excerpt_more', 'new_excerpt_more'); add_action('admin_menu', 'bluenight_theme_page'); add_action('wp_print_scripts', 'deregister_javascript', 100); } endif; /** * Languages Initialization */ if (!function_exists('theme_languages_init')): function theme_languages_init(){ load_theme_textdomain('bluenight', get_template_directory() . '/languages'); } endif; /** * Widgets Initialization */ if (!function_exists('theme_widgets_init')): function theme_widgets_init() { if (function_exists('register_sidebar')){ register_sidebar( array( 'name'=>'Right Sidebar', 'before_widget'=>'', 'before_title'=>'

', 'after_title'=>'

', ) ); } if (function_exists('register_sidebar')){ register_sidebar( array( 'name'=>'Footer', 'before_widget'=>'', 'before_title'=>'

', 'after_title'=>'

', ) ); } } endif; /** * Add BlueNight theme setting */ if (!function_exists('bluenight_theme_page')): function bluenight_theme_page () { global $themename; if ( count($_POST) > 0 && isset($_POST['bluenight_settings']) ) { $options = array ( 'style','logo_img','logo_alt','logo_txt', 'logo_tagline', 'tagline_width', 'contact_email','ads','ads1', 'advertise_page', 'twitter_link', 'facebook_link', 'about_tit', 'about_txt','image_url1','banner_url1','image_url2','banner_url2','image_url3','banner_url3','image_url4','banner_url4','banner_url5','image_url5', 'banner_url6','image_url6','banner_url7','image_url7','analytics','video','videos','featured', 'slide_cat', 'slide_num', 'slide','ss_color'); foreach ( $options as $opt ) { delete_option ( 'bluenight_'.$opt, $_POST[$opt] ); add_option ( 'bluenight_'.$opt, $_POST[$opt] ); } } add_theme_page("BlueNight Panel", "BlueNight Panel", 'edit_themes', basename(__FILE__), 'bluenight_settings'); } endif; if (!function_exists('bluenight_settings')): function bluenight_settings (){ global $themename, $shortname, $options; ?>

Options Panel

General Settings

Leave this empty if you entered an image as logo
Fetaured Posts

'recent_avatar_comments', 'description' => __( 'The most recent comments','bluenight' ) ); parent::__construct('recent-avatar-comments', __('Recent Comments','bluenight').' (BlueNight)', $widget_ops); $this->alt_option_name = 'recent_avatar_comments'; add_action( 'comment_post', array(&$this, 'flush_widget_cache') ); add_action( 'transition_comment_status', array(&$this, 'flush_widget_cache') ); } function flush_widget_cache() { wp_cache_delete('recent_avatar_comments', 'widget'); } function widget( $args, $instance ) { global $comments, $comment; $cache = wp_cache_get('recent_avatar_comments', 'widget'); if ( ! is_array( $cache ) ) $cache = array(); if ( ! isset( $args['widget_id'] ) ) $args['widget_id'] = $this->id; if ( isset( $cache[ $args['widget_id'] ] ) ) { echo $cache[ $args['widget_id'] ]; return; } extract($args, EXTR_SKIP); $output = ''; $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Comments', 'bluenight' ).'(BlueNight)' : $instance['title'], $instance, $this->id_base ); if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) ) $number = 5; $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) ); $output .= $before_widget; if ( $title ) $output .= $before_title . $title . $after_title; $output .= ''; $output .= $after_widget; echo $output; $cache[$args['widget_id']] = $output; wp_cache_set('recent_avatar_comments', $cache, 'widget'); } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['number'] = absint( $new_instance['number'] ); $this->flush_widget_cache(); $alloptions = wp_cache_get( 'alloptions', 'options' ); if ( isset($alloptions['recent_avatar_comments']) ) delete_option('recent_avatar_comments'); return $instance; } function form( $instance ) { $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; $number = isset($instance['number']) ? absint($instance['number']) : 5; ?>

'; $current_after = '

'; $delimiter = '»'; $home = 'Home'; // text for the 'Home' link $before = ''; // tag before the current crumb $after = ''; // tag after the current crumb if (!is_home() && !is_front_page() || is_paged()) { echo $current_before; global $post; $homeLink = home_url('/'); echo ''.$home.' '.$delimiter.' '; if (is_category()) { global $wp_query; $cat_obj = $wp_query->get_queried_object(); $thisCat = $cat_obj->term_id; $thisCat = get_category($thisCat); $parentCat = get_category($thisCat->parent); if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' '.$delimiter.' ')); echo $before.'Archive by category "'.single_cat_title('', false).'"'.$after; } elseif (is_day()) { echo ''.get_the_time('Y').' '.$delimiter.' '; echo ''.get_the_time('F').' '.$delimiter.' '; echo $before.get_the_time('d').$after; } elseif (is_month()) { echo ''.get_the_time('Y').' '.$delimiter.' '; echo $before.get_the_time('F').$after; } elseif (is_year()) { echo $before.get_the_time('Y').$after; } elseif (is_single() && !is_attachment()) { if (get_post_type() != 'post') { $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; echo ''.$post_type->labels->singular_name.' '.$delimiter.' '; echo $before.get_the_title().$after; } else { $cat = get_the_category(); $cat = $cat[0]; echo get_category_parents($cat, TRUE, ' '.$delimiter.' '); echo $before.get_the_title().$after; } } elseif (!is_single() && !is_page() && get_post_type() != 'post') { $post_type = get_post_type_object(get_post_type()); echo $before.$post_type->labels->singular_name.$after; } elseif (is_attachment()) { $parent = get_post($post->post_parent); $cat = get_the_category($parent->ID); $cat = $cat[0]; echo get_category_parents($cat, TRUE, ' '.$delimiter.' '); echo ''.$parent->post_title.' '.$delimiter.' '; echo $before.get_the_title().$after; } elseif (is_page() && !$post->post_parent) { echo $before.get_the_title().$after; } elseif (is_page() && $post->post_parent) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = ''.get_the_title($page->ID).''; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); foreach ($breadcrumbs as $crumb){ echo $crumb.' '.$delimiter.' '; } echo $before.get_the_title().$after; } elseif (is_search()) { echo $before.'Search results for "'.get_search_query().'"'.$after; } elseif (is_tag()) { echo $before.'Posts tagged "'.single_tag_title('', false).'"'.$after; } elseif (is_author()) { global $author; $userdata = get_userdata($author); echo $before.'Articles posted by '.$userdata->display_name.$after; } elseif (is_404()) { echo $before.'Error 404'.$after; } if (get_query_var('paged')) { if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()){ echo ' ('; } echo 'Page '.get_query_var('paged'); if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()){ echo ')'; } } echo $current_after; } else{ if(is_home() && is_front_page()){ echo $current_before.''.get_option('blogname').' '.$delimiter.' '.$before.$home.$after.$current_after; } } } endif; /** * Paginate */ if (!function_exists('paginate')): function paginate($args = null) { $defaults = array( 'page' => null, 'pages' => null, 'range' => 3, 'gap' => 3, 'anchor' => 1, 'echo' => 1 ); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); if (!$page && !$pages) { global $wp_query; $page = get_query_var('paged'); $page = !empty($page) ? intval($page) : 1; $posts_per_page = intval(get_query_var('posts_per_page')); $pages = intval(ceil($wp_query->found_posts / $posts_per_page)); } $output = ""; if ($pages > 1) { $ellipsis = "..."; $min_links = $range * 2 + 1; $block_min = min($page - $range, $pages - $min_links); $block_high = max($page + $range, $min_links); $left_gap = (($block_min - $anchor - $gap) > 0) ? true : false; $right_gap = (($block_high + $anchor + $gap) < $pages) ? true : false; if ($left_gap && !$right_gap) { $output .= sprintf('%s%s%s', paginate_loop(1, $anchor), $ellipsis, paginate_loop($block_min, $pages, $page) ); } else if ($left_gap && $right_gap) { $output .= sprintf('%s%s%s%s%s', paginate_loop(1, $anchor), $ellipsis, paginate_loop($block_min, $block_high, $page), $ellipsis, paginate_loop(($pages - $anchor + 1), $pages) ); } else if ($right_gap && !$left_gap) { $output .= sprintf('%s%s%s', paginate_loop(1, $block_high, $page), $ellipsis, paginate_loop(($pages - $anchor + 1), $pages) ); } else { $output .= paginate_loop(1, $pages, $page); } } if ($echo) { echo $output; } return $output; } endif; if (!function_exists('paginate_loop')): function paginate_loop($start, $max, $page = 0) { $output = ""; for ($i = $start; $i <= $max; $i++) { $output .= ($page === intval($i)) ? "$i" : "$i"; } return $output; } endif; if (!function_exists('show_paginate')): function show_paginate() { ?>
>

|

', '' ); ?>

'.__('View:','bluenight').$count.''; } endif; /** * Update post views count */ if (!function_exists('set_post_views')): function set_post_views($postID) { $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); }else{ $count++; update_post_meta($postID, $count_key, $count); } } endif; if (!function_exists('slider_image')): function slider_image(){ if(has_post_thumbnail()){ ?>

'entry img post-image-prelaoder post-thumbnail') ); ?> ]+./','', $theContent); $limit = $num+1; $content = explode(' ', $output, $limit); array_pop($content); $content = implode(" ",$content)."..."; echo $content; } endif; /** * Format Post Excerpt */ if (!function_exists('my_excerpt_length')): function my_excerpt_length($length) { return __('70','bluenight'); } endif; if (!function_exists('new_excerpt_more')): function new_excerpt_more($more) { global $post; return '... ['.__('Read more','bluenight').']'; } endif; /** * Check the post is in descendant category */ if (!function_exists('post_is_in_descendant_category')): function post_is_in_descendant_category($cats, $_post = null) { foreach ((array) $cats as $cat) { // get_term_children() accepts integer ID only $descendants = get_term_children((int) $cat, 'category'); if ($descendants && in_category($descendants, $_post)) { return true; } } return false; } endif; /** * Related Post */ if (!function_exists('related_post')): function related_post(){ ?> <?php the_title(); ?>
  • id="li-comment-">
    comment_approved == '0') : ?>