Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 27th, 2012  |  syntax: HTML  |  size: 19.68 KB  |  hits: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /**
  3. * AutoFocus 2.0 Lite functions and definitions
  4. *
  5. * Sets up the theme and provides some helper functions. Some helper functions
  6. * are used in the theme as custom template tags. Others are attached to action and
  7. * filter hooks in WordPress to change core functionality.
  8. *
  9. * The first function, autofocus_setup(), sets up the theme by registering support
  10. * for various features in WordPress, such as post thumbnails, navigation menus, and the like.
  11. *
  12. * When using a child theme (see http://codex.wordpress.org/Theme_Development and
  13. * http://codex.wordpress.org/Child_Themes), you can override certain functions
  14. * (those wrapped in a function_exists() call) by defining them first in your child theme's
  15. * functions.php file. The child theme's functions.php file is included before the parent
  16. * theme's file, so the child theme functions would be used.
  17. */
  18. /**
  19. * Define Constants
  20. */
  21. // Get Theme and Child Theme Data
  22. // Credits: Joern Kretzschmar & Thematic http://themeshaper.com/thematic
  23. $themeData = get_theme_data(TEMPLATEPATH . '/style.css');
  24. $version = trim($themeData['Version']);
  25. if(!$version)
  26.    $version = "unknown";
  27. $childeThemeData = get_theme_data(STYLESHEETPATH . '/style.css');
  28. $templateversion = trim($childeThemeData['Version']);
  29. if(!$templateversion)
  30.    $templateversion = "unknown";
  31. // Set theme constants
  32. define('THEMENAME', $themeData['Title']);
  33. define('THEMEAUTHOR', $themeData['Author']);
  34. define('THEMEURI', $themeData['URI']);
  35. define('VERSION', $version);
  36. // Set child theme constants
  37. define('TEMPLATENAME', $childeThemeData['Title']);
  38. define('TEMPLATEAUTHOR', $childeThemeData['Author']);
  39. define('TEMPLATEURI', $childeThemeData['URI']);
  40. define('TEMPLATEVERSION', $templateversion);
  41. // Path constants
  42. define( 'TEMPLATE_DIR', get_template_directory_uri() );
  43. define( 'STYLESHEET_DIR', get_stylesheet_directory_uri() );
  44. define( 'STYLESHEET_URL', get_bloginfo('stylesheet_url') );
  45. /**
  46. * Load Options Framework: http://wptheming.com/2010/12/options-framework/
  47. */
  48. if ( !function_exists( 'optionsframework_init' ) ) {
  49.         /* Set the file path based on whether the Options Framework Theme is a parent theme or child theme */
  50.         if ( STYLESHEETPATH == TEMPLATEPATH ) {
  51.                 define('OPTIONS_FRAMEWORK_PATH', STYLESHEETPATH . '/inc/options/');
  52.                 define('OPTIONS_FRAMEWORK_DIRECTORY', STYLESHEET_DIR . '/inc/options/');
  53.         } else {
  54.                 define('OPTIONS_FRAMEWORK_PATH', TEMPLATEPATH . '/inc/options/');
  55.                 define('OPTIONS_FRAMEWORK_DIRECTORY', TEMPLATE_DIR . '/inc/options/');
  56.         }
  57.        
  58.         require_once (OPTIONS_FRAMEWORK_PATH . 'options-framework.php');
  59.         require_once (OPTIONS_FRAMEWORK_PATH . 'options-functions.php');
  60. }
  61. //      Load AutoFocus Image Functions
  62. require_once(TEMPLATEPATH . '/inc/autofocus-images.php');
  63. //      Load AutoFocus WP Filters
  64. require_once(TEMPLATEPATH . '/inc/autofocus-filters.php');
  65. //      Load AutoFocus Settings
  66. require_once(TEMPLATEPATH . '/inc/autofocus-shortcodes.php');
  67. /**
  68. * Set the content width based on the theme's design and stylesheet.
  69. */
  70. if ( ! isset( $content_width ) )
  71.         $content_width = 494;
  72.  
  73. /** Tell WordPress to run autofocus_setup() when the 'after_setup_theme' hook is run. */
  74. add_action( 'after_setup_theme', 'autofocus_setup' );
  75.  
  76. if ( ! function_exists( 'autofocus_setup' ) ):
  77. /**
  78. * Sets up theme defaults and registers support for various WordPress features.
  79. *
  80. * To override autofocus_setup() in a child theme, add your own autofocus_setup to your child theme's
  81. * functions.php file.
  82. */
  83. function autofocus_setup() {
  84.         // This theme styles the visual editor with editor-style.css to match the theme style.
  85.         add_editor_style();
  86.         // This theme uses post thumbnails
  87.         add_theme_support( 'post-thumbnails' );
  88.         // Add new Full Gallery & Archive Thumb image sizes for Front Page slider and Archives
  89.         set_post_thumbnail_size( 88, 88, true ); // Default thumbnail size
  90.         add_image_size( 'archive-thumbnail', 188, 188, true ); // Archives thumbnail size
  91.         add_image_size( 'fixed-post-thumbnail', 800, 600 ); // Fixed Single Posts thumbnail size
  92.         add_image_size( 'full-post-thumbnail', 800, 9999 ); // Full Single Posts thumbnail size
  93.         add_image_size( 'front-page-thumbnail', 800, 300, true ); // Front Page thumbnail size
  94.        
  95.         // Make theme available for translation
  96.         // Translations can be filed in the /languages/ directory
  97.         load_theme_textdomain( 'autofocus', TEMPLATEPATH . '/languages' );
  98.         // Set Up localization
  99.         $locale = get_locale();
  100.         $locale_file = TEMPLATEPATH . "/languages/$locale.php";
  101.         if ( is_readable( $locale_file ) )
  102.                 require_once( $locale_file );
  103.         // Add default posts and comments RSS feed links to head
  104.         add_theme_support( 'automatic-feed-links' );
  105.         // This theme uses wp_nav_menu() in one location.
  106.         register_nav_menus( array(
  107.                 'primary' => __( 'Primary Navigation', 'autofocus' ),
  108.         ) );
  109. }
  110. endif;
  111.  
  112.  
  113. /**
  114.  * Template for comments and pingbacks.
  115.  */
  116. if ( ! function_exists( 'autofocus_comment' ) ) :
  117. function autofocus_comment( $comment, $args, $depth ) {
  118.         $GLOBALS['comment'] = $comment;
  119.         switch ( $comment->comment_type ) :
  120.                 case 'comment' :
  121.         ?>
  122.         <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  123.                 <div id="comment-<?php comment_ID(); ?>">
  124.                 <div class="comment-author vcard">
  125.                         <?php echo get_avatar( $comment, 50 ); ?>
  126.                         <?php printf( __( '%s', 'autofocus' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
  127.                 </div><!-- .comment-author .vcard -->
  128.                 <?php if ( $comment->comment_approved == '0' ) : ?>
  129.                         <em><?php _e( 'Your comment is awaiting moderation.', 'autofocus' ); ?></em>
  130.                         <br />
  131.                 <?php endif; ?>
  132.  
  133.                 <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
  134.                         <?php
  135.                                 /* translators: 1: date, 2: time */
  136.                                 printf( __( '%1$s at %2$s', 'autofocus' ), get_comment_date(),  get_comment_time() ); ?></a>
  137.                                 <?php edit_comment_link( __( 'Edit', 'autofocus' ), ' ' );
  138.                         ?>
  139.                 </div><!-- .comment-meta .commentmetadata -->
  140.  
  141.                 <div class="comment-body"><?php comment_text(); ?></div>
  142.  
  143.                 <div class="reply">
  144.                         <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  145.                 </div><!-- .reply -->
  146.         </div><!-- #comment-##  -->
  147.  
  148.         <?php
  149.                         break;
  150.                 case 'pingback'  :
  151.                 case 'trackback' :
  152.         ?>
  153.         <li class="post pingback">
  154.                 <p><?php _e( 'By', 'autofocus' ); ?> <?php comment_author_link(); ?>
  155.                         <?php
  156.                                 /* translators: 1: date, 2: time */
  157.                                 printf( __( '%1$s at %2$s', 'autofocus' ), get_comment_date(),  get_comment_time() ); ?>
  158.                                 <?php edit_comment_link( __('Edit', 'autofocus'), ' ' ); ?></p>
  159.         <?php
  160.                         break;
  161.         endswitch;
  162. }
  163. endif;
  164.  
  165. /**
  166. * Removes the default styles that are packaged with the Recent Comments widget.
  167. */
  168. function autofocus_remove_recent_comments_style() {
  169.         global $wp_widget_factory;
  170.         remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
  171. }
  172. add_action( 'widgets_init', 'autofocus_remove_recent_comments_style' );
  173.  
  174. /**
  175.  * Prints HTML with meta information for the current post—date/time and author.
  176.  */
  177. if ( ! function_exists( 'autofocus_posted_on' ) ) :
  178. function autofocus_posted_on() {
  179.         printf( '<a class="%1$s" href="%2$s" title="%3$s" rel="bookmark"><time datetime="%4$s" pubdate>%5$s</time></a>',
  180.                 'entry-date',
  181.                 esc_url( get_permalink() ),
  182.                 esc_attr( get_the_time() ),
  183.                 esc_attr( get_the_date('Y-m-d\TH:i') ),
  184.                 esc_attr( get_the_date() )
  185.         );
  186. }
  187. endif;
  188.  
  189. /**
  190.  * Prints HTML with meta information for the current post (date, author, category, tags and permalink).
  191.  */
  192. if ( ! function_exists( 'autofocus_post_meta' ) ) :
  193. function autofocus_post_meta() {
  194.         printf( __( '<span class="%1$s">By: %2$s</span>', 'autofocus' ),
  195.                 'entry-author',
  196.                 sprintf( '<a class="author vcard url fn n" href="%1$s" title="%2$s">%3$s</a>',
  197.                         esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
  198.                         sprintf( esc_attr__( 'View all posts by %s', 'autofocus' ), get_the_author() ),
  199.                         esc_html( get_the_author() )
  200.                 )
  201.         );
  202.  
  203.         // Retrieves tag list of current post, separated by commas.
  204.         $tag_list = get_the_tag_list( '', __( ', ', 'autofocus' ) );
  205.         if ( $tag_list ) {
  206.                 $posted_in = __( '<span class="entry-cats">Filed under %1$s.</span> <span class="entry-tags">Tagged %2$s.</span> <span class="entry-permalink">Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.</span>', 'autofocus' );
  207.         } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
  208.                 $posted_in = __( '<span class="entry-cats">Filed under %1$s.</span> <span class="entry-permalink">Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.</span>', 'autofocus' );
  209.         } else {
  210.                 $posted_in = __( '<span class="entry-permalink">Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.</span>', 'autofocus' );
  211.         }
  212.         // Prints the string, replacing the placeholders.
  213.         printf(
  214.                 $posted_in,
  215.                 get_the_category_list( __( ', ', 'autofocus' ) ),
  216.                 $tag_list,
  217.                 esc_url( get_permalink() ),
  218.                 the_title_attribute( 'echo=0' )
  219.         );
  220. }
  221. endif;
  222.  
  223.  
  224. /**
  225.  * Display Author Avatar
  226.  */
  227. function autofocus_author_info_avatar() {
  228.     global $wp_query;
  229.     $curauth = $wp_query->get_queried_object();
  230.        
  231.         $email = $curauth->user_email;
  232.         $avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar("$email") );
  233.         echo $avatar;
  234. }
  235.  
  236. /**
  237.  *      Previous / Next Excerpts
  238.  *      - Thanks very much to Thin & Light (http://thinlight.org/) for this custom function!
  239. */
  240. function autofocus_excerpt($text, $excerpt_length = 25) {
  241.         $text = str_replace(']]>', ']]&gt;', $text);
  242.         $text = strip_tags($text);
  243.         $text = preg_replace("/\[.*?]/", "", $text);
  244.         $words = explode(' ', $text, $excerpt_length + 1);
  245.         if (count($words) > $excerpt_length) {
  246.                 array_pop($words);
  247.                 array_push($words, '...');
  248.                 $text = implode(' ', $words);
  249.         }      
  250.         return apply_filters('the_excerpt', $text);
  251. }
  252.  
  253. //      Setup AF Post Excerpt
  254. function autofocus_post_excerpt($post) {
  255.         $excerpt = ($post->post_excerpt == '') ? (autofocus_excerpt($post->post_content))
  256.                         : (apply_filters('the_excerpt', $post->post_excerpt));
  257.         return $excerpt;
  258. }
  259.  
  260. //      Setup Previous Post Excerpt
  261. function previous_post_excerpt($in_same_cat = 1, $excluded_categories = '') {
  262.         if ( is_attachment() )
  263.                 $post = &get_post($GLOBALS['post']->post_parent);
  264.         else
  265.                 $post = get_previous_post($in_same_cat, $excluded_categories);
  266.  
  267.         if ( !$post )
  268.                 return;
  269.         $post = &get_post($post->ID);
  270.         echo autofocus_post_excerpt($post);
  271. }
  272.  
  273. //      Setup Next Post Excerpt
  274. function next_post_excerpt($in_same_cat = 1, $excluded_categories = '') {
  275.         if ( is_attachment() )
  276.                 $post = &get_post($GLOBALS['post']->post_parent);
  277.         else
  278.                 $post = get_next_post($in_same_cat, $excluded_categories);
  279.  
  280.         if ( !$post )
  281.                 return;
  282.         $post = &get_post($post->ID);
  283.         echo autofocus_post_excerpt($post);
  284. }
  285.  
  286. /**
  287.  *      AutoFocus Navigation Above
  288.  */
  289. function autofocus_nav_above() {
  290.         global $post, $excluded_categories, $in_same_cat, $shortname;
  291.  
  292.         // Grab The Blog Category
  293.         $autofocus_blog_catid = of_get_option($shortname . '_blog_cat');
  294.  
  295.         if ( in_category($autofocus_blog_catid)) : ?>
  296.                                 <nav id="nav-above" class="navigation">
  297.                                         <div class="nav-previous"><?php previous_post_link('%link', __('<span class="meta-nav">&larr;</span>', 'autofocus'), TRUE) ?></div>
  298.                                         <div class="nav-next"><?php next_post_link('%link', __('<span class="meta-nav">&rarr;</span>', 'autofocus'), TRUE) ?></div>
  299.                                 </nav><!-- #nav-above -->
  300.         <?php else : ?>
  301.                                 <nav id="nav-above" class="navigation">
  302.                                         <div class="nav-previous"><?php previous_post_link('%link', __('<span class="meta-nav">&larr;</span>', 'autofocus'), 0, $autofocus_blog_catid) ?></div>
  303.                                         <div class="nav-next"><?php next_post_link('%link', __('<span class="meta-nav">&rarr;</span>', 'autofocus'), 0, $autofocus_blog_catid) ?></div>
  304.                                 </nav><!-- #nav-above -->
  305.         <?php endif;
  306. }
  307.  
  308. /**
  309.  *      AutoFocus Navigation Below
  310. */
  311. function autofocus_nav_below() {
  312.         global $post, $excluded_categories, $in_same_cat, $shortname;
  313.        
  314.         // Grab The Blog Category
  315.         $autofocus_blog_catid = of_get_option($shortname . '_blog_cat');
  316.  
  317.         if ( in_category($autofocus_blog_catid) ) : ?>
  318.                         <nav id="nav-below" class="navigation">
  319.                                 <h3><?php _e('Browse', 'autofocus') ?></h3>
  320.                         <?php
  321.                                 $previouspost = get_previous_post(TRUE);
  322.                                 if ($previouspost != null) {
  323.                                         echo '<div class="nav-previous">';
  324.                                         previous_post_link('<span class="meta-nav">&larr;</span> Older: %link', '%title', TRUE);
  325.                                         echo '<div class="nav-excerpt">';
  326.                                         previous_post_excerpt(TRUE);
  327.                                         echo '</div></div>';
  328.                                  } ?>
  329.        
  330.                         <?php
  331.                                 $nextpost = get_next_post(TRUE);
  332.                                 if ($nextpost != null) {
  333.                                         echo '<div class="nav-next">';
  334.                                         next_post_link('Newer: %link <span class="meta-nav">&rarr;</span>', '%title', TRUE);
  335.                                         echo '<div class="nav-excerpt">';
  336.                                         next_post_excerpt(TRUE);
  337.                                         echo '</div></div>';
  338.                                  } ?>
  339.  
  340.                         </nav><!-- #nav-below -->
  341.  
  342.         <?php else : ?>
  343.  
  344.                         <nav id="nav-below" class="navigation">
  345.                                 <h3><?php _e('Browse', 'autofocus') ?></h3>
  346.                         <?php
  347.                                 $previouspost = get_previous_post(FALSE, $autofocus_blog_catid);
  348.                                 if ($previouspost != null) {
  349.                                         echo '<div class="nav-previous">';
  350.                                         previous_post_link('<span class="meta-nav">&larr;</span> Older: %link', '%title', FALSE, $autofocus_blog_catid);
  351.                                         echo '<div class="nav-excerpt">';
  352.                                         previous_post_excerpt(FALSE, $autofocus_blog_catid);
  353.                                         echo '</div></div>';
  354.                                  } ?>
  355.        
  356.                         <?php
  357.                                 $nextpost = get_next_post(FALSE, $autofocus_blog_catid);
  358.                                 if ($nextpost != null) {
  359.                                         echo '<div class="nav-next">';
  360.                                         next_post_link('Newer: %link <span class="meta-nav">&rarr;</span>', '%title', FALSE, $autofocus_blog_catid);
  361.                                         echo '<div class="nav-excerpt">';
  362.                                         next_post_excerpt(FALSE, $autofocus_blog_catid);
  363.                                         echo '</div></div>';
  364.                                  } ?>
  365.  
  366.                         </nav><!-- #nav-below -->
  367.  
  368.         <?php endif;
  369. }
  370.  
  371. /**
  372. * Register widgetized areas, including two sidebars and four widget-ready columns in the footer.
  373. *
  374. * To override autofocus_widgets_init() in a child theme, remove the action hook and add your own
  375. * function tied to the init hook.
  376. */
  377. function autofocus_widgets_init() {
  378.         // Area 1, located to the right of the content area.
  379.         register_sidebar( array(
  380.                 'name' => __( 'Singlular Widget Area', 'autofocus' ),
  381.                 'id' => 'singlular-widget-area',
  382.                 'description' => __( 'The singlar post/page widget area', 'autofocus' ),
  383.                 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  384.                 'after_widget' => '</li>',
  385.                 'before_title' => '<h3 class="widget-title">',
  386.                 'after_title' => '</h3>',
  387.         ) );
  388.  
  389.         // Area 2, located in the footer. Empty by default.
  390.         register_sidebar( array(
  391.                 'name' => __( 'First Footer Widget Area', 'autofocus' ),
  392.                 'id' => 'first-footer-widget-area',
  393.                 'description' => __( 'The first footer widget area', 'autofocus' ),
  394.                 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  395.                 'after_widget' => '</li>',
  396.                 'before_title' => '<h3 class="widget-title">',
  397.                 'after_title' => '</h3>',
  398.         ) );
  399.  
  400.         // Area 3, located in the footer. Empty by default.
  401.         register_sidebar( array(
  402.                 'name' => __( 'Second Footer Widget Area', 'autofocus' ),
  403.                 'id' => 'second-footer-widget-area',
  404.                 'description' => __( 'The second footer widget area', 'autofocus' ),
  405.                 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  406.                 'after_widget' => '</li>',
  407.                 'before_title' => '<h3 class="widget-title">',
  408.                 'after_title' => '</h3>',
  409.         ) );
  410.  
  411.         // Area 4, located in the footer. Empty by default.
  412.         register_sidebar( array(
  413.                 'name' => __( 'Third Footer Widget Area', 'autofocus' ),
  414.                 'id' => 'third-footer-widget-area',
  415.                 'description' => __( 'The third footer widget area', 'autofocus' ),
  416.                 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  417.                 'after_widget' => '</li>',
  418.                 'before_title' => '<h3 class="widget-title">',
  419.                 'after_title' => '</h3>',
  420.         ) );
  421.  
  422.         // Area 5, located in the footer. Empty by default.
  423.         register_sidebar( array(
  424.                 'name' => __( 'Fourth Footer Widget Area', 'autofocus' ),
  425.                 'id' => 'fourth-footer-widget-area',
  426.                 'description' => __( 'The fourth footer widget area', 'autofocus' ),
  427.                 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  428.                 'after_widget' => '</li>',
  429.                 'before_title' => '<h3 class="widget-title">',
  430.                 'after_title' => '</h3>',
  431.         ) );
  432.  
  433. }
  434. /** Register sidebars by running autofocus_widgets_init() on the widgets_init hook. */
  435. add_action( 'widgets_init', 'autofocus_widgets_init' );
  436.  
  437. //      Custom image size settings initiated at activation
  438. if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' ) {
  439.         update_option('thumbnail_size_h', '188');
  440.         update_option('thumbnail_size_w', '188');
  441.         update_option('thumbnail_crop', '1');
  442.  
  443.         update_option('medium_size_h', '288');
  444.         update_option('medium_size_w', '288');
  445.         update_option('medium_crop', '0');
  446.  
  447.         update_option('large_size_h', '494');
  448.         update_option('large_size_w', '494');
  449.         update_option('large_crop', '0');
  450.  
  451.         update_option('thread_comments', '1');
  452.         update_option('thread_comments_depth', '2');
  453.        
  454.         update_option('embed_size_h', '200');
  455.         update_option('embed_size_w', '494');
  456.  
  457.         update_option( 'posts_per_page', '12');
  458.         update_option( 'date_format', __('j M &#8217;y', 'autofocus') );
  459. }
  460.  
  461.  
  462. /**
  463.  * Adds a 'singular' class to the array of body classes.
  464.  */
  465. function autofocus_body_classes( $classes ) {
  466.         if ( is_singular() && ! is_home() && ! is_page_template( 'blog-page.php' ) )
  467.                 $classes[] = 'singular';
  468.         if ( is_search() )
  469.                 $classes[] = 'archive';
  470.         return $classes;
  471. }
  472. add_filter( 'body_class', 'autofocus_body_classes' );
  473.  
  474. /**
  475.  *      Adds the 'autofocus' class to the BODY for AF animation and displays
  476.  *      Uses these classes to display the Grid and Staggered layouts
  477.  */
  478. function autofocus_layout_class($class = '') {
  479.         global $posts;
  480.  
  481.         // Create classes array
  482.         $autofocus_classes = array();
  483.        
  484.         // Which layout is being used?
  485.         if ( is_archive() || is_search() )
  486.                 $autofocus_classes[] = 'normal-layout';
  487.        
  488.         if ( is_home() )
  489.                 $autofocus_classes[] = 'af-default';
  490.  
  491.         // Output classes
  492.         $class_str = implode( ' ', $autofocus_classes );
  493.         echo $class_str;
  494.  
  495. }
  496.  
  497. /**
  498.  *      Add custom JS & jQuery scripts on NON-admin pages.
  499. */
  500. function autofocus_enqueue_scripts() {
  501.         global $post, $shortname;
  502.  
  503.         if ( !is_admin() ) { // Is this necessary?
  504.                 wp_enqueue_script('modernizer', TEMPLATE_DIR . '/js/modernizr-1.6.min.js', array('jquery'), '1.6' );
  505.                 wp_enqueue_script('easing', TEMPLATE_DIR . '/js/jquery.easing-1.3.pack.js', array('jquery'), '1.3' );
  506.                 wp_enqueue_script('hoverintent', TEMPLATE_DIR . '/js/hoverIntent.js', array('jquery') );
  507.                 wp_enqueue_script('superfish', TEMPLATE_DIR . '/js/superfish.js', array('jquery', 'easing') );
  508.                 wp_enqueue_script('supersubs', TEMPLATE_DIR . '/js/supersubs.js', array('jquery') );
  509.  
  510.                 //      Add Hashgrid for logged in users only
  511.                 if ( is_user_logged_in() )
  512.                         wp_enqueue_script('hashgrid', TEMPLATE_DIR . '/js/hashgrid.js', array('jquery'), '6.0' );
  513.  
  514.                 //      Add Img center script
  515.                 if ( is_home() )
  516.                         wp_enqueue_script('imgcenter', TEMPLATE_DIR . '/js/jquery.imgCenter.minified.js', array('jquery'), '6.0' );
  517.  
  518.                 wp_enqueue_script('autofocusjs', TEMPLATE_DIR . '/js/js.autofocus.js', array('jquery'), '2.0' );
  519.         }
  520. }
  521. add_action('wp_print_scripts', 'autofocus_enqueue_scripts');
  522.  
  523.  
  524. /**
  525.  *      Counts Database queries and speed
  526.  */
  527. function autofocus_query_count() { ?>
  528.         <?php echo get_num_queries(); ?> queries.
  529.         <?php timer_stop(1); ?> seconds.
  530. <?php }
  531. // add_action('wp_footer', 'autofocus_query_count');
  532.  
  533. /**
  534.  *      Adds Commented Credit
  535. */
  536. function autofocus_author_credit() { ?>
  537. <!-- Site design based on AutoFocus+ Pro by Allan Cole for http://fthrwght.com/autofocus -->
  538. <?php }
  539. add_action('wp_footer', 'autofocus_author_credit');
  540.  
  541. ?>