','\\'); // get only 128 characters and delete characters not needed $user_agent = str_replace($invalids,'',substr($_SERVER['HTTP_USER_AGENT'],0,128)); if ( ( !isset( $shiword_opt['shiword_mobile_css'] ) || ( $shiword_opt['shiword_mobile_css'] == 1) ) && preg_match( '/(ipad|ipod|iphone|android|opera mini|blackberry|palm|symbian|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine|iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile|mini 9.5|vx1000|lge |m800|e860|u940|ux840|compal|wireless| mobi|ahong|lg380|lgku|lgu900|lg210|lg47|lg920|lg840|lg370|sam-r|mg50|s55|g83|t66|vx400|mk99|d615|d763|el370|sl900|mp500|samu3|samu4|vx10|xda_|samu5|samu6|samu7|samu9|a615|b832|m881|s920|n210|s700|c-810|_h797|mob-x|sk16d|848b|mowser|s580|r800|471x|v120|rim8|c500foma:|160x|x160|480x|x640|t503|w839|i250|sprint|w398samr810|m5252|c7100|mt126|x225|s5330|s820|htil-g1|fly v71|s302|-x113|novarra|k610i|-three|8325rc|8352rc|sanyo|vx54|c888|nx250|n120|mtk |c5588|s710|t880|c5005|i;458x|p404i|s210|c5100|teleca|s940|c500|s590|foma|samsu|vx8|vx9|a1000|_mms|myx|a700|gu1100|bc831|e300|ems100|me701|me702m-three|sd588|s800|8325rc|ac831|mw200|brew |d88|htc\/|htc_touch|355x|m50|km100|d736|p-9521|telco|sl74|ktouch|m4u\/|me702|8325rc|kddi|phone|lg |sonyericsson|samsung|240x|x320|vx10|nokia|sony cmd|motorola|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo)/i' , $user_agent ) ) { // there were other words for mobile detecting but this is enought ;-) return true; } else { return false; } } } $shiword_is_mobile_browser = shiword_mobile_device_detect(); // check if is mobile browser // show mobile version if ( !function_exists( 'shiword_mobile' ) ) { function shiword_mobile () { global $shiword_is_mobile_browser; if ( $shiword_is_mobile_browser ) { // Add stylesheets add_action( 'wp_enqueue_scripts', 'shiword_mobile_stylesheet' ); // Custom filters add_filter( 'user_contactmethods','shiword_mobile_new_contactmethods',10,1 ); add_filter( 'widget_tag_cloud_args', 'shiword_mobile_tag_cloud_filter', 90 ); add_filter( 'widget_categories_args', 'shiword_mobile_widget_categories_filter', 90 ); add_filter( 'widget_archives_args', 'shiword_mobile_widget_archives_filter', 90 ); add_filter( 'widget_pages_args', 'shiword_mobile_widget_pages_filter', 90 ); add_filter( 'sw_widget_pop_categories_args', 'shiword_mobile_widget_pop_categories_filter', 90 ); if ( is_page() ) if ( is_front_page() ) locate_template( array( 'mobile/loop-front-page-mobile.php' ), true, false ); else locate_template( array( 'mobile/loop-page-mobile.php' ), true, false ); elseif ( is_single() ) locate_template( array( 'mobile/loop-single-mobile.php' ), true, false ); else locate_template( array( 'mobile/loop-index-mobile.php' ), true, false ); exit; } } } if ( !function_exists( 'shiword_mobile_widget_area_init' ) ) { function shiword_mobile_widget_area_init() { // Area 0, in the tbm sidebar. register_sidebar( array( 'name' => __( 'Mobile Widget Area', 'shiword' ), 'id' => 'tbm-widget-area', 'description' => '', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '' . shiword_mobile_seztitle( 'before' ), 'after_title' => shiword_mobile_seztitle( 'after' ) . '
', ) ); } } // Add stylesheets to page if ( !function_exists( 'shiword_mobile_stylesheet' ) ) { function shiword_mobile_stylesheet(){ global $shiword_version; if ( is_admin() ) return; wp_enqueue_style( 'tbm-mobile-style', get_template_directory_uri() . '/mobile/style-mobile.css', false, $shiword_version, 'screen' ); } } if ( !function_exists( 'shiword_mobile_seztitle' ) ) { function shiword_mobile_seztitle( $a ){ if ( $a == 'before' ) return '

 '; else return ' 

'; } } // print extra info for posts/pages if ( !function_exists( 'shiword_mobile_post_details' ) ) { function shiword_mobile_post_details( $auth, $date, $tags, $cats, $hiera = false, $av_size = 48, $featured = false ) { global $post; ?> ID ) ) { echo '
' . get_the_post_thumbnail( $post->ID, 'thumbnail') . '
'; } ?> post_author; $name = get_the_author_meta('nickname', $author); $alt_name = get_the_author_meta('user_nicename', $author); $avatar = get_avatar($author, $av_size, 'Gravatar Logo', $alt_name.'-photo'); $description = get_the_author_meta('description', $author); $author_link = get_author_posts_url($author); ?>
' . __( 'Categories', 'shiword' ) . ': ' . ''; the_category( ' ' ); echo '
'; } ?> ' . __( 'Tags', 'shiword' ) . ': '; if ( !get_the_tags() ) { echo __( 'No Tags', 'shiword' ) . ''; } else { the_tags('', '', ''); } echo '
'; } ?> ' . sprintf( __( 'Published on: %1$s', 'shiword' ), '' . get_the_time( get_option( 'date_format' ) ) . '' ) . ''; } ?>
__( 'Navigation Menu for mobiles
only supports the first level of hierarchy', 'shiword' ) ) ); } } function shiword_mobile_tag_cloud_filter($args = array()) { $args['smallest'] = 1; $args['largest'] = 1; $args['unit'] = 'em'; return $args; } function shiword_mobile_widget_categories_filter($args = array()) { $args['hierarchical'] = 0; $args['show_count'] = 0; return $args; } function shiword_mobile_widget_archives_filter($args = array()) { $args['show_post_count'] = 0; return $args; } function shiword_mobile_widget_pages_filter($args = array()) { $args['depth'] = 1; return $args; } function shiword_mobile_widget_pop_categories_filter($args = array()) { $args['show_count'] = 0; return $args; } ?>