Advertising
- functions.php
- Thursday, May 10th, 2012 at 12:06:40am MDT
- <?php/** * @package WordPress * @subpackage MxS */ /** ----------------------------------------------- * Theme Translate*/ add_action( 'after_setup_theme', 'MxS_init' );if ( ! function_exists( 'MxS_init' ) ):function MxS_init(){/** ----------------------------------------------- * Theme support*/if ( ! isset( $content_width ) ) $content_width = 640;add_theme_support( 'post-thumbnails' );set_post_thumbnail_size( 130, 130, false );add_theme_support('automatic-feed-links');add_theme_support( 'post-formats', array( 'video', 'quote' ) );load_theme_textdomain( 'MxS', TEMPLATEPATH . '/languages' );add_custom_background();define('HEADER_TEXTCOLOR', '111111');define('HEADER_IMAGE_WIDTH', 1000); // use width and height appropriate for your themedefine('HEADER_IMAGE_HEIGHT', 140);// Don't support text inside the header image.if ( ! defined( 'NO_HEADER_TEXT' ) ){ define( 'NO_HEADER_TEXT', true ); }}endif;/** ----------------------------------------------- * custom background*/ function MxS_header_style() { ?><style type="text/css"> #header { background:#fff url(<?php header_image(); ?>); } .siteName a,.description{color:#<?php header_textcolor() ?>} </style><?php} /** ----------------------------------------------- * gets included in the admin header */ function MxS_admin_header_style() { ?><style type="text/css"> #headimg { width: <?php echo HEADER_IMAGE_WIDTH; ?>px; height: <?php echo HEADER_IMAGE_HEIGHT; ?>px; } </style><?php}add_custom_image_header('MxS_header_style', 'MxS_admin_header_style');/** ----------------------------------------------- * Theme uses wp_nav_menu() in one location. Chack if function exist*/ if( function_exists('register_nav_menus') ){register_nav_menus( array( 'primary' => __( 'Primary Navigation', 'MxS'),) );}/** ----------------------------------------------- * widget setting*/ if ( !function_exists('MxS_widgets_init') ) {function MxS_widgets_init() { register_sidebar( array( 'name' => __( 'Primary Widget Area', 'MxS'), 'id' => 'primary-widget-area', 'description' => __( 'The primary widget area', 'MxS') , 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li>', 'before_title' => '<span class="widgettitle">', 'after_title' => '</span>', ) ); register_sidebar( array( 'name' => __( 'First Footer Widget Area', 'MxS'), 'id' => 'first-footer-widget-area', 'description' => __( 'The first footer widget area', 'MxS' ), 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li>', 'before_title' => '<span class="widgettitle">', 'after_title' => '</span>', ) ); register_sidebar( array( 'name' => __( 'Second Footer Widget Area', 'MxS'), 'id' => 'second-footer-widget-area', 'description' => __( 'The second footer widget area', 'MxS' ), 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li>', 'before_title' => '<span class="widgettitle">', 'after_title' => '</span>', ) ); register_sidebar( array( 'name' => __( 'Third Footer Widget Area', 'MxS'), 'id' => 'third-footer-widget-area', 'description' => __( 'The third footer widget area', 'MxS' ), 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li>', 'before_title' => '<span class="widgettitle">', 'after_title' => '</span>', ) ); register_sidebar( array( 'name' => __( 'Fourth Footer Widget Area', 'MxS'), 'id' => 'fourth-footer-widget-area', 'description' => __( 'The fourth footer widget area', 'MxS' ), 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li>', 'before_title' => '<span class="widgettitle">', 'after_title' => '</span>', ) );}add_action( 'widgets_init', 'MxS_widgets_init' );}/** ----------------------------------------------- * Page navi Previous 1 2 3 4 5 6 Next*/ if ( !function_exists('MxS_pagenavi') ) { function MxS_pagenavi($range = 7){ global $paged, $wp_query, $max_page; if ( !$max_page ) {$max_page = $wp_query->max_num_pages;} if($max_page > 1){if(!$paged){$paged = 1;} echo '<span> '.$paged.' / '.$max_page.'</span>'; if($paged != 1){echo "<a rel='nofollow' href='" . get_pagenum_link(1) . "' class='extend' title=".__('First Page','MxS').">". __('First','MxS')."</a>";} previous_posts_link(__('previous','MxS')); if($max_page > $range){ if($paged < $range){for($i = 1; $i <= ($range + 1); $i++){echo "<a rel='nofollow' href='" . get_pagenum_link($i) ."'"; if($i==$paged)echo " class='current'";echo ">$i</a>";}} elseif($paged >= ($max_page - ceil(($range/2)))){ for($i = $max_page - $range; $i <= $max_page; $i++){echo "<a rel='nofollow' href='" . get_pagenum_link($i) ."'"; if($i==$paged)echo " class='current'";echo ">$i</a>";}} elseif($paged >= $range && $paged < ($max_page - ceil(($range/2)))){ for($i = ($paged - ceil($range/2)); $i <= ($paged + ceil(($range/2))); $i++){echo "<a rel='nofollow' href='" . get_pagenum_link($i) ."'";if($i==$paged) echo " class='current'";echo ">$i</a>";}}} else{for($i = 1; $i <= $max_page; $i++){echo "<a rel='nofollow' href='" . get_pagenum_link($i) ."'"; if($i==$paged)echo " class='current'";echo ">$i</a>";}} next_posts_link(__('next','MxS')); if($paged != $max_page){echo "<a rel='nofollow' href='" . get_pagenum_link($max_page) . "' class='extend' title=".__('Last Page','MxS').">". __('Last','MxS')."</a>";}} }}/** *modified commentform**/function MxS_fields($fields) {if(isset($_COOKIE['comment_author_'.COOKIEHASH])) {$lastCommenter = $_COOKIE['comment_author_'.COOKIEHASH];$lastEmail = $_COOKIE['comment_author_email_'.COOKIEHASH];$lastUrl = $_COOKIE['comment_author_url_'.COOKIEHASH];$fields = array( 'author' => '<div id="author_info"><p class="comment-form-author">' . '<input id="author" name="author" type="text" value="' . $lastCommenter . '" size="30" /><span class="required">*</span>' . '<label for="author">' . __( 'Name', 'MxS' ) . '</label></p>', 'email' => '<p class="comment-form-email"><input id="email" name="email" type="text" value="' . $lastEmail . '" size="30" /> <span class="required">*</span><label for="email">' . __( 'Email', 'MxS' ) . '</label></p>', 'url' => '<p class="comment-form-url">' . '<input id="url" name="url" type="text" value="' . $lastUrl . '" size="30" /><label for="url">' . __( 'Website', 'MxS' ) . '</label></p></div>');}else{$fields = array( 'author' => '<p class="comment-form-author">' . '<input id="author" name="author" type="text" size="30" /> <span class="required">*</span><label for="author">' . __( 'Name', 'MxS' ) . '</label></p>', 'email' => '<p class="comment-form-email">' . '<input id="email" name="email" type="text" size="30" /> <span class="required">*</span><label for="email">' . __( 'Email', 'MxS' ) . '</label></p>', 'url' => '<p class="comment-form-url">' . '<input id="url" name="url" type="text" size="30" /> <label for="url">' . __( 'Website', 'MxS' ) . '</label></p>', );} return $fields; } add_filter('comment_form_default_fields','MxS_fields');/** ----------------------------------------------- * custom comments*/ if ( ! function_exists('MxS_custom_comments')) {function MxS_custom_comments($comment, $args, $depth) {$GLOBALS['comment'] = $comment;?><li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"><div id="comment-<?php comment_ID(); ?>"><div class="message_head"><span class="avatarx"><?php echo get_avatar($comment,$size='40',$default='' ); ?></span><span class="name"><?php comment_author_link() ?></span> <?php edit_comment_link( __( '(Edit)', 'mxs_theme' ), ' ' ); ?><span class="reply"><?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => get_option('thread_comments_depth') ) ) ); ?></span></div><span class="date"><?php comment_date('y/m/d') ?></span><div class="clear"></div><div class="cmt_text"><?php comment_text(); ?></div></div><!-- #comment-## --> <?php }}
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.