array( 'url' => '%s/images/slideshow/001.jpg', 'thumbnail_url' => '%s/images/slideshow/001-thumb.png', /* translators: header image description */ 'description' => __( 'Sea', 'yiw' ) ), 'flowers' => array( 'url' => '%s/images/slideshow/002.jpg', 'thumbnail_url' => '%s/images/slideshow/002-thumb.png', /* translators: header image description */ 'description' => __( 'Flowers', 'yiw' ) ), 'portrait' => array( 'url' => '%s/images/slideshow/003.jpg', 'thumbnail_url' => '%s/images/slideshow/003-thumb.png', /* translators: header image description */ 'description' => __( 'Portrait', 'yiw' ) ), 'hearth' => array( 'url' => '%s/images/slideshow/004.jpg', 'thumbnail_url' => '%s/images/slideshow/004-thumb.png', /* translators: header image description */ 'description' => __( 'Heart', 'yiw' ) ), 'black-white' => array( 'url' => '%s/images/slideshow/005.jpg', 'thumbnail_url' => '%s/images/slideshow/005-thumb.png', /* translators: header image description */ 'description' => __( 'Black & White', 'yiw' ) ) ) ); $locale = get_locale(); $locale_file = TEMPLATEPATH . "/languages/$locale.php"; if ( is_readable( $locale_file ) ) require_once( $locale_file ); // This theme uses wp_nav_menu() in more locations. register_nav_menus( array( 'nav' => __( 'Navigation' ) ) ); // images size add_image_size( 'team-thumb', 100, 100 ); add_image_size( 'thumb-recentposts', 55, 55, true ); // for shortcode add_image_size( 'portfolio-thumb', 280, 149 ); add_image_size( 'portfolio-thumb-slider', 193, 118, true ); add_image_size( 'portfolio-thumb-gallery', 179, 179, true ); // sidebars registers register_sidebar( yiw_sidebar_args( 'Blog Sidebar', __( 'The sidebar showed on page with Blog template', 'yiw' ) ) ); register_sidebar( yiw_sidebar_args( 'Home Row', __( 'The row below home content.', 'yiw' ), 'one-third', 'h2' ) ); // styles wp_enqueue_style ( 'prettyPhoto', get_template_directory_uri()."/css/prettyPhoto.css" ); // add custom style add_action( 'wp_head', 'yiw_custom_style', 999 ); // add custom js add_action( 'wp_footer', 'yiw_custom_js', 999 ); } add_action( 'after_setup_theme', 'beauty_setup' ); /** * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. * * To override this in a child theme, remove the filter and optionally add * your own function tied to the wp_page_menu_args filter hook. * * @since Twenty Ten 1.0 */ function yiw_page_menu_args( $args ) { $args['show_home'] = true; $args['menu_class'] = 'menu'; return $args; } add_filter( 'wp_page_menu_args', 'yiw_page_menu_args' ); $yiw_theme_modules = array( dirname(__FILE__) . '/../includes/colors.php', dirname(__FILE__) . '/../includes/fonts.php', dirname(__FILE__) . '/../admin-options/yiw_panel.php', //dirname(__FILE__) . '/../admin-options/notify_update.php';, dirname(__FILE__) . '/../admin-options/backend.php', dirname(__FILE__) . '/../admin-options/metaboxes.php', dirname(__FILE__) . '/../admin-options/dashboard.php', //dirname(__FILE__) . '/../admin-options/tinymce/tinymce.php', dirname(__FILE__) . '/../includes/widgets/widgets.php', dirname(__FILE__) . '/../includes/shortcodes.php', dirname(__FILE__) . '/../includes/sendemail.php' ); function yiw_custom_style() { global $yiw_theme_options; yiw_string_( '' ); } function yiw_custom_js() { global $yiw_theme_options; yiw_string_( '' ); } function yiw_sidebar_args( $name, $description = '', $widget_class = 'widget', $title = 'h3' ) { $id = strtolower( str_replace( ' ', '-', $name ) ); return array( 'name' => $name, 'id' => $id, 'description' => $description, 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '<' . $title . '>', 'after_title' => '', ); } if ( ! function_exists( 'yiw_admin_header_style' ) ) : /** * Styles the header image displayed on the Appearance > Header admin panel. * * Referenced via add_custom_image_header() in twentyten_setup(). * * @since Twenty Ten 1.0 */ function yiw_admin_header_style() { ?> $v) { $b[$k] = strtolower( $v[$subkey] ); } asort($b); foreach($b as $key => $val) { $c[] = $a[$key]; } return $c; } return $a; } $yiw_message = ''; // set of icons $yiw_icons_name = array( 'bag', 'box', 'bubble', 'bulb', 'calendar', 'cart', 'chart', 'clipboard', 'coffee', 'diagram', 'doodles', 'gear', 'gift', 'globe', 'info', 'label', 'letter', 'moleskine', 'monitor', 'mphone', 'new', 'open', 'pc', 'pencil', 'phone', 'pictures', 'postit', 'qmark', 'refresh', 'shopbag', 'statistics', 'testimonial', 'tick', 'bag-grey', 'card-grey', 'cart-grey', 'mail-grey', 'pencil-grey', 'phone-grey', 'users-grey' ); // tags for text $yiw_tags_allowed = array( 'name_site' => get_bloginfo('name'), 'description_site' => get_bloginfo('description'), 'site_url' => site_url() ); // include theme modules foreach ( $yiw_theme_modules as $module ) if ( file_exists( $module ) ) include_once $module; unset( $module ); function yiw_catch_that_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('//i', $post->post_content, $matches); $first_img = $matches [1] [0]; if(empty($first_img)){ //Defines a default image $first_img = get_stylesheet_directory_uri()."/images/default.gif"; } return $first_img; } $count = 0; if ( ! function_exists( 'yiw_comment' ) ) : /** * Template for comments and pingbacks. * * To override this walker in a child theme without modifying the comments template * simply create your own twentyten_comment(), and that function will be used instead. * * Used as a callback by wp_list_comments() for displaying the comments. * * @since Twenty Ten 1.0 */ function yiw_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; $GLOBALS['count'] = $GLOBALS['count']+1; switch ( $comment->comment_type ) : case '' : ?>
  • id="li-comment-">
    %s', get_comment_author_link() ) ); ?>
  • post_name ) ) return $post->post_name; else return ''; } function yiw_exclude_categories() { global $yiw_theme_options; if ( !isset( $yiw_theme_options['blog_cats_exclude'][1] ) ) return; $cats = $yiw_theme_options['blog_cats_exclude'][1]; $return = implode( ', -', $cats ); if ( $return != '' ) $return = '-' . $return; return $return; } // --------------- SCRIPTS JS -------------------- function yiw_add_footer_js_scripts() { ?> = 18) { return False; } else { Return True; } } //------------------------------------------------------------------------------ // CHECK GENERIC //------------------------------------------------------------------------------ function yiw_get_convertTags($str, $class = '', $after = '') { global $yiw_tags_allowed; if( $class != '' ) $class = ' class="' . $class . '"'; $str = str_replace('[', '', $str); $str = str_replace(']', '', $str); foreach( $yiw_tags_allowed as $tag => $value ) $str = str_replace( "%$tag%", $value, $str ); return $str . $after; } function yiw_convertTags($str, $class = '', $after = '') { echo yiw_get_convertTags($str, $class, $after); } add_filter( 'widget_title', 'yiw_get_convertTags' ); add_filter( 'bloginfo', 'yiw_get_convertTags' ); function yiw_favicon() { global $yiw_theme_options; $favicon = $yiw_theme_options['favicon']; echo $favicon['url']; } function yiw_logo() { global $yiw_theme_options; $logo = $yiw_theme_options['logo']; if ( $logo['url'] == '' ) $logo['url'] = get_template_directory_uri() . '/images/logo.png'; echo $logo['url']; } // adjust logo function yiw_add_dynamic_logo_size() { global $yiw_theme_options; $_show_logo = $yiw_theme_options['show_logo']; $custom_width = $yiw_theme_options['logo_width']; $custom_height = $yiw_theme_options['logo_height']; $margin = 20; if( $_show_logo AND $custom_width != '' AND $custom_height != '' ) { ?> "; $i++; } if($n AND $i > $n) break; } closedir($handle); } // $html = ''; // for($i = 0; $i < get_option('nums_images_slideshow_home_f'); $i++) // { // $html .= "\"001\""; // } echo $html; } function yiw_url_icon($icon, $size = 32) { global $yiw_icons_name; $path = "/images/icons/{$icon}{$size}.png"; if( file_exists( STYLESHEETPATH . $path ) ) return get_template_directory_uri() . "/images/icons/{$icon}{$size}.png"; else return get_template_directory_uri() . "/images/icons/{$icon}.png"; } function yiw_list_icons( $selected = false, $echo = TRUE ) { global $yiw_icons_name; $html = ''; foreach($yiw_icons_name as $icon) $html .= ''."\n"; if($echo) echo $html; return $html; } /** * Add "first" and "last" CSS classes to dynamic sidebar widgets. Also adds numeric index class for each widget (widget-1, widget-2, etc.) */ function yiw_widget_first_last_classes($params) { global $yiw_widget_num; // Global a counter array $this_id = $params[0]['id']; // Get the id for the current sidebar we're processing $arr_registered_widgets = wp_get_sidebars_widgets(); // Get an array of ALL registered widgets if(!$yiw_widget_num) {// If the counter array doesn't exist, create it $yiw_widget_num = array(); } if(!isset($arr_registered_widgets[$this_id]) || !is_array($arr_registered_widgets[$this_id])) { // Check if the current sidebar has no widgets return $params; // No widgets in this sidebar... bail early. } if(isset($yiw_widget_num[$this_id])) { // See if the counter array has an entry for this sidebar $yiw_widget_num[$this_id] ++; } else { // If not, create it starting with 1 $yiw_widget_num[$this_id] = 1; } $class = 'class="widget-' . $yiw_widget_num[$this_id] . ' '; // Add a widget number class for additional styling options if($yiw_widget_num[$this_id] == 1) { // If this is the first widget $class .= 'widget-first '; } elseif($yiw_widget_num[$this_id] == count($arr_registered_widgets[$this_id])) { // If this is the last widget $class .= 'widget-last '; } $params[0]['before_widget'] = str_replace('class="', $class, $params[0]['before_widget']); // Insert our new classes into "before widget" return $params; } add_filter('dynamic_sidebar_params','yiw_widget_first_last_classes'); function yiw_links_sliders( &$a, &$url, $slide ) { switch( $slide['link_type'] ) { case 'page': $a = TRUE; $url = get_permalink( $slide['link_page'] ); break; case 'category': $a = TRUE; $theCatId = get_category_by_slug( $slide['link_category'] ); $url = get_category_link( $theCatId->term_id ); break; case 'url': $a = TRUE; $url = $slide['link_url']; break; case 'none': $a = FALSE; $url = ''; break; } } function yiw_featured_content( $slide, $before = '', $after = '', $container = true ) { global $link; switch( $slide['content_type'] ) { case 'image' : ?>
    max_num_pages; if( !$pages ) $pages = 1; } if( 1 != $pages ) { echo "
    "; if( $paged > 2 ) echo "«"; if( $paged > 1 ) echo ""; for ( $i=1; $i <= $pages; $i++ ) { if( 1 != $pages &&( !( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) { $class = ( $paged == $i ) ? " class='selected'" : ''; echo "$i"; } } if ( $paged < $pages ) echo ""; if ( $paged < $pages - 1 ) echo "»"; clear(); echo "
    \n"; } } ?>