__( 'Primary Navigation', 'autofocus' ), ) ); } endif; /** * Template for comments and pingbacks. */ if ( ! function_exists( 'autofocus_comment' ) ) : function autofocus_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case 'comment' : ?>
  • id="li-comment-">
    %s', get_comment_author_link() ) ); ?>
    comment_approved == '0' ) : ?>
    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  • widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) ); } add_action( 'widgets_init', 'autofocus_remove_recent_comments_style' ); /** * Prints HTML with meta information for the current post—date/time and author. */ if ( ! function_exists( 'autofocus_posted_on' ) ) : function autofocus_posted_on() { printf( '', 'entry-date', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date('Y-m-d\TH:i') ), esc_attr( get_the_date() ) ); } endif; /** * Prints HTML with meta information for the current post (date, author, category, tags and permalink). */ if ( ! function_exists( 'autofocus_post_meta' ) ) : function autofocus_post_meta() { printf( __( 'By: %2$s', 'autofocus' ), 'entry-author', sprintf( '%3$s', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), sprintf( esc_attr__( 'View all posts by %s', 'autofocus' ), get_the_author() ), esc_html( get_the_author() ) ) ); // Retrieves tag list of current post, separated by commas. $tag_list = get_the_tag_list( '', __( ', ', 'autofocus' ) ); if ( $tag_list ) { $posted_in = __( 'Filed under %1$s. Tagged %2$s. Bookmark the permalink.', 'autofocus' ); } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) { $posted_in = __( 'Filed under %1$s. Bookmark the permalink.', 'autofocus' ); } else { $posted_in = __( 'Bookmark the permalink.', 'autofocus' ); } // Prints the string, replacing the placeholders. printf( $posted_in, get_the_category_list( __( ', ', 'autofocus' ) ), $tag_list, esc_url( get_permalink() ), the_title_attribute( 'echo=0' ) ); } endif; /** * Display Author Avatar */ function autofocus_author_info_avatar() { global $wp_query; $curauth = $wp_query->get_queried_object(); $email = $curauth->user_email; $avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar("$email") ); echo $avatar; } /** * Previous / Next Excerpts * - Thanks very much to Thin & Light (http://thinlight.org/) for this custom function! */ function autofocus_excerpt($text, $excerpt_length = 25) { $text = str_replace(']]>', ']]>', $text); $text = strip_tags($text); $text = preg_replace("/\[.*?]/", "", $text); $words = explode(' ', $text, $excerpt_length + 1); if (count($words) > $excerpt_length) { array_pop($words); array_push($words, '...'); $text = implode(' ', $words); } return apply_filters('the_excerpt', $text); } // Setup AF Post Excerpt function autofocus_post_excerpt($post) { $excerpt = ($post->post_excerpt == '') ? (autofocus_excerpt($post->post_content)) : (apply_filters('the_excerpt', $post->post_excerpt)); return $excerpt; } // Setup Previous Post Excerpt function previous_post_excerpt($in_same_cat = 1, $excluded_categories = '') { if ( is_attachment() ) $post = &get_post($GLOBALS['post']->post_parent); else $post = get_previous_post($in_same_cat, $excluded_categories); if ( !$post ) return; $post = &get_post($post->ID); echo autofocus_post_excerpt($post); } // Setup Next Post Excerpt function next_post_excerpt($in_same_cat = 1, $excluded_categories = '') { if ( is_attachment() ) $post = &get_post($GLOBALS['post']->post_parent); else $post = get_next_post($in_same_cat, $excluded_categories); if ( !$post ) return; $post = &get_post($post->ID); echo autofocus_post_excerpt($post); } /** * AutoFocus Navigation Above */ function autofocus_nav_above() { global $post, $excluded_categories, $in_same_cat, $shortname; // Grab The Blog Category $autofocus_blog_catid = of_get_option($shortname . '_blog_cat'); if ( in_category($autofocus_blog_catid)) : ?> __( 'Singlular Widget Area', 'autofocus' ), 'id' => 'singlular-widget-area', 'description' => __( 'The singlar post/page widget area', 'autofocus' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Area 2, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'First Footer Widget Area', 'autofocus' ), 'id' => 'first-footer-widget-area', 'description' => __( 'The first footer widget area', 'autofocus' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Area 3, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Second Footer Widget Area', 'autofocus' ), 'id' => 'second-footer-widget-area', 'description' => __( 'The second footer widget area', 'autofocus' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Area 4, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Third Footer Widget Area', 'autofocus' ), 'id' => 'third-footer-widget-area', 'description' => __( 'The third footer widget area', 'autofocus' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Area 5, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Fourth Footer Widget Area', 'autofocus' ), 'id' => 'fourth-footer-widget-area', 'description' => __( 'The fourth footer widget area', 'autofocus' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); } /** Register sidebars by running autofocus_widgets_init() on the widgets_init hook. */ add_action( 'widgets_init', 'autofocus_widgets_init' ); // Custom image size settings initiated at activation if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' ) { update_option('thumbnail_size_h', '188'); update_option('thumbnail_size_w', '188'); update_option('thumbnail_crop', '1'); update_option('medium_size_h', '288'); update_option('medium_size_w', '288'); update_option('medium_crop', '0'); update_option('large_size_h', '494'); update_option('large_size_w', '494'); update_option('large_crop', '0'); update_option('thread_comments', '1'); update_option('thread_comments_depth', '2'); update_option('embed_size_h', '200'); update_option('embed_size_w', '494'); update_option( 'posts_per_page', '12'); update_option( 'date_format', __('j M ’y', 'autofocus') ); } /** * Adds a 'singular' class to the array of body classes. */ function autofocus_body_classes( $classes ) { if ( is_singular() && ! is_home() && ! is_page_template( 'blog-page.php' ) ) $classes[] = 'singular'; if ( is_search() ) $classes[] = 'archive'; return $classes; } add_filter( 'body_class', 'autofocus_body_classes' ); /** * Adds the 'autofocus' class to the BODY for AF animation and displays * Uses these classes to display the Grid and Staggered layouts */ function autofocus_layout_class($class = '') { global $posts; // Create classes array $autofocus_classes = array(); // Which layout is being used? if ( is_archive() || is_search() ) $autofocus_classes[] = 'normal-layout'; if ( is_home() ) $autofocus_classes[] = 'af-default'; // Output classes $class_str = implode( ' ', $autofocus_classes ); echo $class_str; } /** * Add custom JS & jQuery scripts on NON-admin pages. */ function autofocus_enqueue_scripts() { global $post, $shortname; if ( !is_admin() ) { // Is this necessary? wp_enqueue_script('modernizer', TEMPLATE_DIR . '/js/modernizr-1.6.min.js', array('jquery'), '1.6' ); wp_enqueue_script('easing', TEMPLATE_DIR . '/js/jquery.easing-1.3.pack.js', array('jquery'), '1.3' ); wp_enqueue_script('hoverintent', TEMPLATE_DIR . '/js/hoverIntent.js', array('jquery') ); wp_enqueue_script('superfish', TEMPLATE_DIR . '/js/superfish.js', array('jquery', 'easing') ); wp_enqueue_script('supersubs', TEMPLATE_DIR . '/js/supersubs.js', array('jquery') ); // Add Hashgrid for logged in users only if ( is_user_logged_in() ) wp_enqueue_script('hashgrid', TEMPLATE_DIR . '/js/hashgrid.js', array('jquery'), '6.0' ); // Add Img center script if ( is_home() ) wp_enqueue_script('imgcenter', TEMPLATE_DIR . '/js/jquery.imgCenter.minified.js', array('jquery'), '6.0' ); wp_enqueue_script('autofocusjs', TEMPLATE_DIR . '/js/js.autofocus.js', array('jquery'), '2.0' ); } } add_action('wp_print_scripts', 'autofocus_enqueue_scripts'); /** * Counts Database queries and speed */ function autofocus_query_count() { ?> queries. seconds.