(.*?)!s", '', $css); } /********************* SCRIPTS & ENQUEUEING *********************/ function emerald_styles() { if (!is_admin()) { global $wp_styles; // call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way // register main stylesheet wp_register_style( 'emerald-stylesheet', get_stylesheet_directory_uri() . '/library/css/style.css', array(), '', 'all' ); wp_register_style( 'slider-stylesheet', get_stylesheet_directory_uri() . '/library/css/home-slider.css', array(), '', 'all' ); // ie-only style sheet wp_register_style( 'emerald-ie-only', get_stylesheet_directory_uri() . '/library/css/ie.css', array(), '' ); wp_enqueue_style( 'emerald-stylesheet' ); wp_enqueue_style( 'slider-stylesheet' ); wp_enqueue_style('emerald-ie-only'); $wp_styles->add_data( 'emerald-ie-only', 'conditional', 'lt IE 9' ); // add conditional wrapper around ie stylesheet } } // loading modernizr and jquery, and reply script function emerald_scripts() { if (!is_admin()) { // modernizr (without media query polyfill) wp_register_script( 'emerald_modernizr', get_stylesheet_directory_uri() . '/library/js/libs/modernizr.custom.min.js', array(), '2.5.3', false ); // comment reply script for threaded comments if ( is_singular() AND comments_open() AND (get_option('thread_comments') == 1)) { wp_enqueue_script( 'comment-reply' ); } //adding scripts file in the footer wp_register_script( 'emerald_js', get_stylesheet_directory_uri() . '/library/js/scripts.js', array( 'jquery' ), '', true ); //Responsive slider wp_register_script( 'emerald_responsive_slides', get_template_directory_uri().'/library/js/libs/responsiveslides.min.js', array('jquery') ); wp_register_script( 'emerald_responsive_slides_settings', get_template_directory_uri().'/library/js/libs/responsiveslides-hooks-settings.js', array('responsive_slides') ); //Hover intent wp_register_script( 'emerald_hover_intent', get_template_directory_uri().'/library/js/libs/hoverIntent.min.js', array('jquery') ); //Fit Vids wp_register_script( 'emerald_fit_vids', get_template_directory_uri().'/library/js/libs/jquery.fitvids.js', array('jquery') ); // enqueue styles and scripts wp_enqueue_script( 'emerald_modernizr' ); wp_enqueue_script( 'emerald_fit_vids' ); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'emerald_js' ); wp_enqueue_script( 'emerald_hover_intent' ); if( is_home() ){ wp_enqueue_script( 'emerald_responsive_slides' ); wp_enqueue_script( 'emerald_responsive_slides_settings' ); } } } /********************* THEME SUPPORT *********************/ // Adding WP 3+ Functions & Theme Support function emerald_theme_support() { // wp thumbnails (sizes handled in functions.php) add_theme_support('post-thumbnails'); // default thumb size set_post_thumbnail_size(125, 125, true); // Thumbnail sizes add_image_size( 'emerald-thumb-600', 600, 150, true ); add_image_size( 'emerald-thumb-300', 300, 100, true ); add_image_size( 'emerald-thumb-250-square', 250, 250, true ); add_image_size( 'emerald-thumb-200-square', 200, 200, true ); add_image_size( 'emerald-thumb-150-square', 150, 150, true ); // wp custom background (thx to @bransonwerner for update) add_theme_support( 'custom-background', array( 'default-image' => '', // background image default 'default-color' => '', // background color default (dont add the #) 'wp-head-callback' => '_custom_background_cb', 'admin-head-callback' => '', 'admin-preview-callback' => '' ) ); // rss thingy add_theme_support('automatic-feed-links'); // registering wp3+ menus register_nav_menus( array( 'main-nav' => __( 'The Main Menu', 'emeraldtheme' ), // main nav in header 'footer-links' => __( 'Footer Links', 'emeraldtheme' ) // secondary nav in footer ) ); } /* end emerald theme support */ /********************* WP Title *********************/ function emerald_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) return $title; // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( __( 'Page %s', 'twentytwelve' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'emerald_wp_title', 10, 2 ); /********************* MENUS & NAVIGATION *********************/ // the main menu function emerald_main_nav() { // display the wp3 menu if available wp_nav_menu(array( 'container' => false, // remove nav container 'container_class' => 'menu clearfix', // class of container (should you choose to use it) 'menu' => __( 'The Main Menu', 'emeraldtheme' ), // nav name 'menu_class' => 'nav top-nav clearfix', // adding custom nav class 'theme_location' => 'main-nav', // where it's located in the theme 'before' => '', // before the menu 'after' => '', // after the menu 'link_before' => '', // before each link 'link_after' => '', // after each link 'depth' => 0, // limit the depth of the nav 'fallback_cb' => 'emerald_main_nav_fallback' // fallback function )); } /* end emerald main nav */ // the footer menu (should you choose to use one) function emerald_footer_links() { // display the wp3 menu if available wp_nav_menu(array( 'container' => '', // remove nav container 'container_class' => 'footer-links clearfix', // class of container (should you choose to use it) 'menu' => __( 'Footer Links', 'emeraldtheme' ), // nav name 'menu_class' => 'nav footer-nav clearfix', // adding custom nav class 'theme_location' => 'footer-links', // where it's located in the theme 'before' => '', // before the menu 'after' => '', // after the menu 'link_before' => '', // before each link 'link_after' => '', // after each link 'depth' => 0, // limit the depth of the nav 'fallback_cb' => 'emerald_footer_links_fallback' // fallback function )); } /* end emerald footer link */ // this is the fallback for header menu function emerald_main_nav_fallback() { wp_page_menu( array( 'show_home' => true, 'menu_class' => 'nav top-nav clearfix', // adding custom nav class 'include' => '', 'exclude' => '', 'echo' => true, 'link_before' => '', // before each link 'link_after' => '' // after each link ) ); } // this is the fallback for footer menu function emerald_footer_links_fallback() { /* you can put a default here if you like */ } /********************* PAGE NAVI *********************/ // Numeric Page Navi (built into the theme by default) function emerald_page_navi($before = '', $after = '') { global $wpdb, $wp_query; $request = $wp_query->request; $posts_per_page = intval(get_query_var('posts_per_page')); $paged = intval(get_query_var('paged')); $numposts = $wp_query->found_posts; $max_page = $wp_query->max_num_pages; if ( $numposts <= $posts_per_page ) { return; } if(empty($paged) || $paged == 0) { $paged = 1; } $pages_to_show = 7; $pages_to_show_minus_1 = $pages_to_show-1; $half_page_start = floor($pages_to_show_minus_1/2); $half_page_end = ceil($pages_to_show_minus_1/2); $start_page = $paged - $half_page_start; if($start_page <= 0) { $start_page = 1; } $end_page = $paged + $half_page_end; if(($end_page - $start_page) != $pages_to_show_minus_1) { $end_page = $start_page + $pages_to_show_minus_1; } if($end_page > $max_page) { $start_page = $max_page - $pages_to_show_minus_1; $end_page = $max_page; } if($start_page <= 0) { $start_page = 1; } echo $before.''.$after.""; } /* end page navi */ /********************* RANDOM CLEANUP ITEMS *********************/ // cleaning up random code around images add_filter('the_content', 'emerald_filter_ptags_on_images'); // remove the p from around imgs (http://css-tricks.com/snippets/wordpress/remove-paragraph-tags-from-around-images/) function emerald_filter_ptags_on_images($content){ return preg_replace('/

\s*()?\s*()\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content); } // cleaning up excerpt add_filter('excerpt_more', 'emerald_excerpt_more'); // This removes the annoying […] to a Read More link function emerald_excerpt_more($more) { global $post; // edit here if you like return '... '. __('Read more »', 'emeraldtheme') .''; } /* * This is a modified the_author_posts_link() which just returns the link. * * This is necessary to allow usage of the usual l10n process with printf(). */ function emerald_get_the_author_posts_link() { global $authordata; if ( !is_object( $authordata ) ) return false; $link = sprintf( '', get_author_posts_url( $authordata->ID, $authordata->user_nicename ), esc_attr( sprintf( __( 'Posts by %s', "emeraldtheme" ), get_the_author() ) ), // No further l10n needed, core will take care of this one get_the_author() ); return $link; } /********************************************************************/ /************* INCLUDE NEEDED FILES ***************/ include('options-panel.php'); require_once('library/translation/translation.php'); // this comes turned off by default /************** CONTENT WIDTH *********************/ if ( ! isset( $content_width ) ) $content_width = 600; /************* ACTIVE SIDEBARS ********************/ // Sidebars & Widgetizes Areas function emerald_register_sidebars() { register_sidebar(array( 'id' => 'sidebar-1', 'name' => __('Main Sidebar', 'emeraldtheme'), 'description' => __('The main sidebar.', 'emeraldtheme'), 'before_widget' => '

', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); } // don't remove this bracket! function emerald_prev_next_links(){ ?>
  • >
    ' ); */ ?> %s', 'emeraldtheme'), get_comment_author_link()) ?>
    comment_approved == '0') : ?>

    $depth, 'max_depth' => $args['max_depth']))) ?>
    '; return $form; } // don't remove this bracket! /************** NAV ***************************/ function emerald_header_dropdown_nav(){ $return_val = ''; return $return_val; } function emerald_credit_links($type){ if($type == 'nofollow') _e('Theme by WP Gurus.', 'emeraldtheme'); elseif(($type == 'homepage' && !is_front_page()) || $type == 'hide') return; else _e('Theme by WP Gurus.', 'emeraldtheme'); } add_action('after_switch_theme', 'emerald_theme_activation'); function emerald_theme_activation(){ header('Location: ' . admin_url() . 'themes.php?page=emerald_settings'); } ?>