'sidebar', 'name' => __( 'sidebar', 'NewSpring' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ' )); } add_action( 'widgets_init', 'NewSpring_widgets_init'); function NewSpring_setup() { // Set languages load_theme_textdomain( 'NewSpring', get_template_directory() . '/languages' ); // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style(); // Add default posts and comments RSS feed links to head add_theme_support( 'automatic-feed-links' ); add_theme_support( 'post-formats', array( 'aside', 'gallery' ) ); // This theme uses post thumbnails add_theme_support( 'post-thumbnails' ); register_nav_menus( array( 'primary' => __( 'Primary Navigation', 'NewSpring' ), ) ); } function NewSpring_new_excerpt_length($length) { return 20; } add_filter('excerpt_length', 'NewSpring_new_excerpt_length',999); add_filter( 'use_default_gallery_style', '__return_false' ); function NewSpring_remove_gallery_css( $css ) { return preg_replace( "##s", '', $css ); } // Backwards compatibility with WordPress 3.0. if ( version_compare( $GLOBALS['wp_version'], '3.1', '<' ) ) add_filter( 'gallery_style', 'NewSpring_remove_gallery_css' ); if ( ! function_exists( 'NewSpring_posted_in' ) ) : /** * Prints HTML with meta information for the current post (category, tags and permalink). */ function NewSpring_posted_in() { // Retrieves tag list of current post, separated by commas. $tag_list = get_the_tag_list( '', ', ' ); if ( $tag_list ) { $posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the permalink.', 'NewSpring' ); } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) { $posted_in = __( 'This entry was posted in %1$s. Bookmark the permalink.', 'NewSpring' ); } else { $posted_in = __( 'Bookmark the permalink.', 'NewSpring' ); } // Prints the string, replacing the placeholders. printf( $posted_in, get_the_category_list( ', ' ), $tag_list, get_permalink(), the_title_attribute( 'echo=0' ) ); } endif; add_action( 'after_setup_theme', 'NewSpring_setup'); function NewSpring_the_thumbnail() { global $post; if ( has_post_thumbnail() ) { echo ''; the_post_thumbnail('thumbnail'); echo ''; } else { $content = $post->post_content; preg_match_all('//sim', $content, $strResult, PREG_PATTERN_ORDER); $n = count($strResult[1]); if($n > 0){ echo 'thumbnail'; }else { echo 'thumbnail'; } } } ?>