__( 'Main Navigation', 'sharonchin' ), 'header-menu' => __( 'Header Menu', 'sharonchin' ), 'footer-menu' => __( 'Footer Menu', 'sharonchin' ) ) ); /* Add Image sizes */ add_image_size( 'archive-item', 275, 225, true ); // Hard Crop Mode add_image_size( 'lilypad', 342, 9999); // Soft Crop Mode add_image_size( 'slider', 620, 9999); // Soft Crop Mode add_image_size( 'mini-thumbnail', 9999, 60); // Soft Crop Mode } // sharonchin_setup endif; add_action( 'after_setup_theme', 'sharonchin_setup' ); /** * Returns the options object for Sharon Chin Theme. * * @author Automattic * @since 1.3.0 - 06.04.2012 * * @return stdClass Theme Options */ function sharonchin_options() { return (object) wp_parse_args( get_option( 'sharonchin_theme_options', array() ), sharonchin_get_default_theme_options() ); } /** * Returns the default options for Sharon Chin Theme. * * @author Automattic * @since 1.3.0 - 06.04.2012 * * @return void */ function sharonchin_get_default_theme_options() { $default_theme_options = array( 'theme_layout' => 'content-sidebar', 'navbar_site_name' => false, 'navbar_searchform' => true, 'navbar_inverse' => true, 'navbar_position' => 'static', ); return apply_filters( 'sharonchin_default_theme_options', $default_theme_options ); } /** * Adds Sharon Chin Theme layout classes to the array of body classes. * * @author WordPress.org * @since 1.3.0 - 06.04.2012 * * @return void */ function sharonchin_layout_classes( $existing_classes ) { $classes = array( sharonchin_options()->theme_layout ); $classes = apply_filters( 'sharonchin_layout_classes', $classes ); return array_merge( $existing_classes, $classes ); } add_filter( 'body_class', 'sharonchin_layout_classes' ); /** * Adds Custom Background support * * @author Konstantin Obenland * @since 1.2.5 - 11.04.2012 * * @return void */ function sharonchin_custom_background_setup() { $args = apply_filters( 'sharonchin_custom_background_args', array( 'default-color' => 'EFEFEF', ) ); add_theme_support( 'custom-background', $args ); } add_action( 'after_setup_theme', 'sharonchin_custom_background_setup' ); /** * Register the sidebars. * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @return void */ function sharonchin_widgets_init() { if ( function_exists('register_sidebar') ) { register_sidebar( array( 'name' => __( 'Main Sidebar', 'sharonchin' ), 'id' => 'main', 'before_widget' => '', 'before_title' => '
', ) ); } include_once( 'inc/sharonchin-image-meta-widget.php' ); register_widget( 'SharonChin_Image_Meta_Widget' ); include_once( 'inc/sharonchin-gallery-widget.php' ); register_widget( 'SharonChin_Gallery_Widget' ); } add_action( 'widgets_init', 'sharonchin_widgets_init' ); /** * Registration of theme scripts and styles * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @return void */ function sharonchin_register_scripts_styles() { if ( ! is_admin() ) { $theme_version = sharonchin_version(); $suffix = ( defined('SCRIPT_DEBUG') AND SCRIPT_DEBUG ) ? '' : '.min'; $bootstrap_css_dependencies = array(); /** * Scripts */ // Use less just in local server. if( WP_DEBUG === true ){ // Register the bootstrap.less wp_register_style( 'lesscss', get_stylesheet_directory_uri() . '/less/bootstrap.less', //$bootstrap_css_dependencies, array(), '2.3.2' ); } else { /** * Styles */ wp_register_style( 'tw-bootstrap', get_template_directory_uri() . "/css/bootstrap{$suffix}.css", array(), '2.0.3' ); wp_register_style( 'sharonchin', get_template_directory_uri() . "/style{$suffix}.css", array('tw-bootstrap'), $theme_version ); } } } add_action( 'init', 'sharonchin_register_scripts_styles' ); /** * Properly enqueue frontend scripts * * @author Konstantin Obenland * @since 1.0.0 - 05.02.2012 * * @return void */ function sharonchin_print_scripts() { $suffix = ( defined('SCRIPT_DEBUG') AND SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'jquery' ); wp_enqueue_script('tw-bootstrap', get_template_directory_uri() . "/js/bootstrap{$suffix}.js"); wp_enqueue_script('sharonchin', get_template_directory_uri() . "/js/sharonchin{$suffix}.js"); wp_enqueue_script( 'masonry' , get_stylesheet_directory_uri() . "/js/masonry.pkgd{$suffix}.js"); wp_enqueue_script('imagesloaded', get_stylesheet_directory_uri() . "/js/imagesloaded.pkgd{$suffix}.js"); wp_enqueue_script('sharon', get_stylesheet_directory_uri() . "/js/sharon.js"); if( WP_DEBUG === true ){ wp_enqueue_script( 'delete-cache', get_stylesheet_directory_uri() . '/js/delete_cache.js'); wp_enqueue_script('lessjs', get_stylesheet_directory_uri() . '/js/less-1.4.1.min.js'); wp_enqueue_style('lesscss'); } else { wp_enqueue_style('sharon-bootstrap'); } wp_enqueue_style('sharonchin'); } add_action( 'wp_enqueue_scripts', 'sharonchin_print_scripts' ); /** * Add headers to the less files! * * @author Roberto Ulloa * @since 1.0.0 - 12.07.2013 * * @return void */ function sharonchin_enqueue_less_styles($tag, $handle) { global $wp_styles; $match_pattern = '/\.less$/U'; if ( preg_match( $match_pattern, $wp_styles->registered[$handle]->src ) ) { $handle = $wp_styles->registered[$handle]->handle; $media = $wp_styles->registered[$handle]->args; $href = $wp_styles->registered[$handle]->src . '?ver=' . $wp_styles->registered[$handle]->ver; $rel = isset($wp_styles->registered[$handle]->extra['alt']) && $wp_styles->registered[$handle]->extra['alt'] ? 'alternate stylesheet' : 'stylesheet/less'; $title = isset($wp_styles->registered[$handle]->extra['title']) ? "title='" . esc_attr( $wp_styles->registered[$handle]->extra['title'] ) . "'" : ''; $tag = ""; } return $tag; } add_filter( 'style_loader_tag', 'sharonchin_enqueue_less_styles', 5, 2); /** * Adds IE specific scripts * * Respond.js has to be loaded after Theme styles * * @author Konstantin Obenland * @since 1.7.0 - 11.06.2012 * * @return void */ function sharonchin_print_ie_scripts() { ?> navbar_position ) { $top_bottom = str_replace( 'navbar-fixed-', '', sharonchin_options()->navbar_position ); $css = "body > .container{margin-{$top_bottom}:68px;}@media(min-width: 980px){body > .container{margin-{$top_bottom}:58px;}}"; if ( is_admin_bar_showing() AND 'top' == $top_bottom ) $css .= '.navbar.navbar-fixed-top{margin-top:28px;}'; if ( function_exists( 'wp_add_inline_style' ) ) wp_add_inline_style( 'sharonchin', $css ); else echo "\n"; } } add_action( 'wp_enqueue_scripts', 'sharonchin_print_styles' ); if ( ! function_exists( 'sharonchin_credits' ) ) : /** * Prints HTML with meta information for the current post-date/time and author, * comment and edit link * * @author Konstantin Obenland * @since 1.2.2 - 07.04.2012 * * @return void */ function sharonchin_credits() { printf( '' . __( '© %1$s %3$s, all rights reserved.', 'sharonchin' ) . '', date( 'Y' ), home_url( '/' ), get_bloginfo( 'name' ) ); } endif; /** * Returns the blogname if no title was set. * * @author Konstantin Obenland * @since 1.1.0 - 18.03.2012 * * @param string $title * @param string $sep * * @return string */ function sharonchin_wp_title( $title, $sep ) { if ( ! is_feed() ) { $title .= get_bloginfo( 'name' ); if ( is_front_page() ) { $title .= " {$sep} " . get_bloginfo( 'description' ); } } return $title; } add_filter( 'wp_title', 'sharonchin_wp_title', 1, 2 ); /** * Returns a "Read More" link for excerpts * * @author Roberto Ulloa * @since 1.0.0 - 14.06.2013 * * @param string $more * * @return string */ function sharonchin_continue_reading_link() { return ' ' . __( 'Read more ', 'sharonchin' ) . ''; } /** * Get the wp_nav_menu() fallback, wp_page_menu(), to show a home link. * * @author WordPress.org * @since 1.0.0 - 05.02.2012 * * @param array $args * * @return array */ function sharonchin_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'sharonchin_page_menu_args' ); /** * Filter in a link to a content ID attribute for the next/previous image links on image attachment pages * * @author Automattic * @since 1.0.0 - 05.02.2012 * * @param string $url * @param int $id * * @return string */ function sharonchin_enhanced_image_navigation( $url, $id ) { if ( is_attachment() AND wp_attachment_is_image( $id ) ) { $image = get_post( $id ); if ( $image->post_parent AND $image->post_parent != $id ) $url .= '#primary'; } return $url; } add_filter( 'attachment_link', 'sharonchin_enhanced_image_navigation', 10, 2 ); /** * Displays comment list, when there are any * * @author Konstantin Obenland * @since 1.7.0 - 16.06.2012 * * @return void */ function sharonchin_comments_list() { if ( post_password_required() ) : ?>', '' ); ?>
' . ( $req ? '' . __('required', 'sharonchin') . ', ' : '' ) . __( 'will not be published', 'sharonchin' ) . '