is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','tz_exclude_pages');
/*-----------------------------------------------------------------------------------*/
/* Register WP3.0+ Menus
/*-----------------------------------------------------------------------------------*/
function register_menu() {
register_nav_menu('primary-menu', __('Primary Menu'));
}
add_action('init', 'register_menu');
/*-----------------------------------------------------------------------------------*/
/* Load Translation Text Domain
/*-----------------------------------------------------------------------------------*/
load_theme_textdomain ('framework');
/*-----------------------------------------------------------------------------------*/
/* Set Max Content Width (use in conjuction with ".entry-content img" css)
/*-----------------------------------------------------------------------------------*/
if ( ! isset( $content_width ) ) $content_width = 600;
/*-----------------------------------------------------------------------------------*/
/* Register Sidebars
/*-----------------------------------------------------------------------------------*/
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'Main Sidebar',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
));
register_sidebar(array(
'name' => 'Page Sidebar',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
register_sidebar(array(
'name' => 'Portfolio Sidebar',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
}
/*-----------------------------------------------------------------------------------*/
/* Post Formats
/*-----------------------------------------------------------------------------------*/
$formats = array(
'aside',
'gallery',
'link',
'image',
'quote',
'audio',
'video');
add_theme_support( 'post-formats', $formats );
add_post_type_support( 'post', 'post-formats' );
/*-----------------------------------------------------------------------------------*/
/* Configure WP2.9+ Thumbnails
/*-----------------------------------------------------------------------------------*/
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 50, 50, true ); // Normal post thumbnails
add_image_size( 'thumbnail-portfolio', 220, 160, true ); // Portfolio thumbnails
add_image_size( 'image-thumb', 500, '', true ); // Image format thumbnails
add_image_size( 'gallery-thumb', 500, '', true ); // Gallery format thumbnails
}
/*-----------------------------------------------------------------------------------*/
/* Change Default Excerpt Length
/*-----------------------------------------------------------------------------------*/
function tz_excerpt_length($length) {
return 16; }
add_filter('excerpt_length', 'tz_excerpt_length');
/*-----------------------------------------------------------------------------------*/
/* Configure Excerpt String
/*-----------------------------------------------------------------------------------*/
function tz_excerpt_more($excerpt) {
return str_replace('[...]', '...', $excerpt); }
add_filter('wp_trim_excerpt', 'tz_excerpt_more');
/*-----------------------------------------------------------------------------------*/
/* Register and load common JS
/*-----------------------------------------------------------------------------------*/
function tz_enqueue_scripts() {
// register our scripts
wp_register_script('superfish', get_template_directory_uri() . '/js/superfish.js', 'jquery');
wp_register_script('validation', 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js', 'jquery');
wp_register_script('easing', get_template_directory_uri() . '/js/jquery.easing.1.3.js', 'jquery');
wp_register_script('tz_custom', get_template_directory_uri() . '/js/jquery.custom.js', 'jquery', '1.0', TRUE);
wp_register_script('fancybox', get_template_directory_uri().'/js/jquery.fancybox-1.3.4.pack.js', 'jquery');
wp_register_script('slidesjs', get_template_directory_uri().'/js/slides.min.jquery.js', 'jquery');
wp_register_script('jPlayer', get_template_directory_uri().'/js/jquery.jplayer.min.js', 'jquery');
// register our stylesheets
wp_register_style( 'fancybox', get_template_directory_uri() . '/css/fancybox/jquery.fancybox-1.3.4.css' );
// enqueue our scripts
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_script('jquery-ui-accordion');
wp_enqueue_script('jPlayer');
wp_enqueue_script('slidesjs');
wp_enqueue_script('fancybox');
wp_enqueue_script('easing');
wp_enqueue_script('superfish');
wp_enqueue_script('tz_custom');
if( is_page_template('template-contact.php') ) { wp_enqueue_script('validation'); }
if( is_singular() ) { wp_enqueue_script( 'comment-reply' ); }
// enqueue our stylesheets
wp_enqueue_style( 'fancybox' );
}
add_action('wp_enqueue_scripts', 'tz_enqueue_scripts');
/*-----------------------------------------------------------------------------------*/
/* Register and load admin javascript
/*-----------------------------------------------------------------------------------*/
function tz_admin_js($hook) {
if ($hook == 'post.php' || $hook == 'post-new.php') {
wp_register_script('tz-admin', get_template_directory_uri() . '/js/jquery.custom.admin.js', 'jquery');
wp_enqueue_script('tz-admin');
}
}
add_action('admin_enqueue_scripts','tz_admin_js',10,1);
/*-----------------------------------------------------------------------------------*/
/* Add Browser Detection Body Class
/*-----------------------------------------------------------------------------------*/
add_filter('body_class','tz_browser_body_class');
function tz_browser_body_class($classes) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
elseif($is_opera) $classes[] = 'opera';
elseif($is_NS4) $classes[] = 'ns4';
elseif($is_safari) $classes[] = 'safari';
elseif($is_chrome) $classes[] = 'chrome';
elseif($is_IE) $classes[] = 'ie';
else $classes[] = 'unknown';
if($is_iphone) $classes[] = 'iphone';
return $classes;
}
/*-----------------------------------------------------------------------------------*/
/* Comment Styling
/*-----------------------------------------------------------------------------------*/
function tz_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
id="li-comment-">