/wp-content/themes/WP960gs-master/functions.php
PHP | 209 lines | 167 code | 29 blank | 13 comment | 15 complexity | 4a4cb7deb43837cfa06ece4be95edd0f MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, AGPL-1.0
- <?php
- if ( ! isset( $content_width ) ) $content_width = 680;
- add_action( 'after_setup_theme', 'twentyten_setup' );
- if ( ! function_exists( 'twentyten_setup' ) ):
- function twentyten_setup() {
- add_editor_style();
- // add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
- add_theme_support( 'post-thumbnails' );
- /*
- add_image_size('max-thumbnail',640,250,true);
- add_image_size('thumbnail-200-100',200,100,true);
- */
- add_theme_support( 'automatic-feed-links' );
- load_theme_textdomain( 'twentyten', get_template_directory() . '/languages' );
- $locale = get_locale();
- $locale_file = get_template_directory() . "/languages/$locale.php";
- if ( is_readable( $locale_file ) )
- require_once( $locale_file );
- // This theme uses wp_nav_menu() in one location.
- register_nav_menus( array(
- 'primary' => __( 'Primary Navigation', 'twentyten' ),
- 'footer-menu' => __( 'Footer Navigation' , 'twentyten')
- ) );
- }
- endif;
- if ( ! function_exists( 'twentyten_admin_header_style' ) ) :
- function twentyten_admin_header_style() {
- ?>
- <style type="text/css">
- #headimg {
- border-bottom: 1px solid #000;
- border-top: 4px solid #000;
- }
- </style>
- <?php
- }
- endif;
- function twentyten_page_menu_args( $args ) {
- $args['show_home'] = true;
- return $args;
- }
- add_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' );
- function twentyten_excerpt_length( $length ) {
- return 40;
- }
- add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
- function twentyten_continue_reading_link() {
- return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) . '</a>';
- }
- function twentyten_auto_excerpt_more( $more ) {
- return ' …' . twentyten_continue_reading_link();
- }
- add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
- function twentyten_custom_excerpt_more( $output ) {
- if ( has_excerpt() && ! is_attachment() ) {
- $output .= twentyten_continue_reading_link();
- }
- return $output;
- }
- add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
- add_filter( 'use_default_gallery_style', '__return_false' );
- function twentyten_remove_gallery_css( $css ) {
- return preg_replace( "#<style type='text/css'>(.*?)</style>#s", '', $css );
- }
- if ( version_compare( $GLOBALS['wp_version'], '3.1', '<' ) )
- add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
- if ( ! function_exists( 'twentyten_comment' ) ) :
- function twentyten_comment( $comment, $args, $depth ) {
- $GLOBALS['comment'] = $comment;
- switch ( $comment->comment_type ) :
- case '' :
- ?>
- <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
- <div id="comment-<?php comment_ID(); ?>">
- <div class="comment-author vcard">
- <?php echo get_avatar( $comment, 40 ); ?>
- <?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
- </div><!-- .comment-author .vcard -->
- <?php if ( $comment->comment_approved == '0' ) : ?>
- <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
- <br />
- <?php endif; ?>
- <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
- <?php
- /* translators: 1: date, 2: time */
- printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );
- ?>
- </div><!-- .comment-meta .commentmetadata -->
- <div class="comment-body"><?php comment_text(); ?></div>
- <div class="reply">
- <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
- </div><!-- .reply -->
- </div><!-- #comment-## -->
- <?php
- break;
- case 'pingback' :
- case 'trackback' :
- ?>
- <li class="post pingback">
- <p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' ); ?></p>
- <?php
- break;
- endswitch;
- }
- endif;
- function twentyten_widgets_init() {
- // Area 1, located at the top of the sidebar.
- register_sidebar( array(
- 'name' => __( 'Primary Widget Area', 'twentyten' ),
- 'id' => 'primary-widget-area',
- 'description' => __( 'The primary widget area', 'twentyten' ),
- 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
- 'after_widget' => '</li>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- // Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
- register_sidebar( array(
- 'name' => __( 'Secondary Widget Area', 'twentyten' ),
- 'id' => 'secondary-widget-area',
- 'description' => __( 'The secondary widget area', 'twentyten' ),
- 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
- 'after_widget' => '</li>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- // Area 3, located in the footer. Empty by default.
- register_sidebar( array(
- 'name' => __( 'Footer Widget Area', 'twentyten' ),
- 'id' => 'first-footer-widget-area',
- 'description' => __( 'The first footer widget area', 'twentyten' ),
- 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
- 'after_widget' => '</li>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- }
- add_action( 'widgets_init', 'twentyten_widgets_init' );
- function twentyten_remove_recent_comments_style() {
- add_filter( 'show_recent_comments_widget_style', '__return_false' );
- }
- add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );
- if ( ! function_exists( 'twentyten_posted_on' ) ) :
- function twentyten_posted_on() {
- printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
- 'meta-prep meta-prep-author',
- sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
- get_permalink(),
- esc_attr( get_the_time() ),
- get_the_date()
- ),
- sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
- get_author_posts_url( get_the_author_meta( 'ID' ) ),
- esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author() ) ),
- get_the_author()
- )
- );
- }
- endif;
- if ( ! function_exists( 'twentyten_posted_in' ) ) :
- function twentyten_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 <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
- } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
- $posted_in = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
- } else {
- $posted_in = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
- }
- // Prints the string, replacing the placeholders.
- printf(
- $posted_in,
- get_the_category_list( ', ' ),
- $tag_list,
- get_permalink(),
- the_title_attribute( 'echo=0' )
- );
- }
- endif;