PageRenderTime 67ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 1ms

/functions.php

https://github.com/flashpatric/lat55
PHP | 553 lines | 402 code | 36 blank | 115 comment | 89 complexity | f01b73f709cd341d42fd90dc4fdaa585 MD5 | raw file
  1. <?php
  2. /**
  3. * @package Themolio
  4. */
  5. ?>
  6. <?php
  7. /**
  8. * Setting the content width based on theme's layout
  9. */
  10. if(!isset($content_width))
  11. $content_width = 740;
  12. /**
  13. * Calling the theme options template and retrieving the theme options
  14. */
  15. require(get_template_directory().'/admin/theme-options.php');
  16. $themolio_options = themolio_get_options();
  17. $themolio_is_mobile = themolio_is_mobile();
  18. /**
  19. * Telling wordpress to run themolio_setup whenever "after_setup_theme" hook is run
  20. */
  21. add_action('after_setup_theme', 'themolio_setup');
  22. if (!function_exists('themolio_setup')):
  23. function themolio_setup() {
  24. /* Make Themolio available for translation.
  25. * Translations can be added to the /languages/ directory.
  26. * If you're building a theme based on Themolio, use a find and replace
  27. * to change 'themolio' to the name of your theme in all the template files.
  28. */
  29. load_theme_textdomain('themolio', get_template_directory().'/languages' );
  30. add_editor_style();
  31. add_theme_support('automatic-feed-links');
  32. add_theme_support('post-thumbnails');
  33. /**
  34. * This sets up the image size for the grid based top-down layouts (with no sidebar).
  35. * If you change the width/height of your content,
  36. * you will have to modify the width and height mentioned below as well
  37. */
  38. add_image_size('themolio-two-col-grid-image-nosidebar',460,300,true);
  39. add_image_size('themolio-three-col-grid-image-nosidebar',300,200,true);
  40. add_image_size('themolio-four-col-grid-image-nosidebar',210,150,true);
  41. /**
  42. * This sets up the image size for the grid based top-down layouts (with sidebar).
  43. * If you change the width/height of your content,
  44. * you will have to modify the width and height mentioned below as well
  45. */
  46. add_image_size('themolio-two-col-grid-image-sidebar',356,250,true);
  47. add_image_size('themolio-three-col-grid-image-sidebar',230,150,true);
  48. add_image_size('themolio-four-col-grid-image-sidebar',171,110,true);
  49. /**
  50. * This sets up the image size for the featured image.
  51. * If you change the width/height of your content,
  52. * you will have to modify the width and height mentioned below as well
  53. */
  54. add_image_size('themolio-featured-image',800,300,true);
  55. register_nav_menu('primary', __('Primary Menu', 'themolio'));
  56. add_theme_support('post-formats', array('link', 'gallery', 'status', 'quote', 'image', 'video'));
  57. if(themolio_is_wp_version('3.4')) {
  58. add_theme_support('custom-background');
  59. } else {
  60. add_custom_background();
  61. }
  62. /**
  63. * Add theme support for infinite scroll
  64. */
  65. add_theme_support( 'infinite-scroll', array(
  66. 'container' => 'grid-content',
  67. 'footer' => 'page'
  68. ) );
  69. }
  70. endif;
  71. /**
  72. * Checks the version of WP
  73. */
  74. function themolio_is_wp_version($is_ver) {
  75. $wp_ver = explode('.', get_bloginfo('version'));
  76. $is_ver = explode('.', $is_ver);
  77. for($i=0; $i<=count($is_ver); $i++)
  78. if(!isset($wp_ver[$i])) array_push($wp_ver, 0);
  79. foreach($is_ver as $i => $is_val)
  80. if($wp_ver[$i] < $is_val) return false;
  81. return true;
  82. }
  83. /**
  84. * This removes the default gallery styling applied by wordpress
  85. */
  86. add_filter('use_default_gallery_style', '__return_false');
  87. /**
  88. * Default menu to use if custom menu is not used
  89. */
  90. function themolio_page_menu_args($args) {
  91. $args['show_home'] = false;
  92. $args['menu_class'] = 'main-menu clearfix';
  93. return $args;
  94. }
  95. add_filter('wp_page_menu_args', 'themolio_page_menu_args');
  96. /**
  97. * Enqueue javascript files required by theme
  98. */
  99. function themolio_enqueue_head_scripts() {
  100. global $themolio_options;
  101. if(is_admin())
  102. return;
  103. if(is_singular() && get_option('thread_comments'))
  104. wp_enqueue_script('comment-reply');
  105. wp_enqueue_script('jquery');
  106. wp_register_script('themolio-theme-js', get_template_directory_uri().'/js/themolio.js','jquery');
  107. wp_enqueue_script('themolio-dropdown-js');
  108. wp_enqueue_script('themolio-browser-detect-js');
  109. wp_enqueue_script('themolio-theme-js');
  110. }
  111. add_action('wp_enqueue_scripts', 'themolio_enqueue_head_scripts');
  112. function themolio_enqueue_footer_scripts() {
  113. wp_register_script('flowgrid-js', get_template_directory_uri().'/js/flowgrid.js',array(), false, true);
  114. wp_enqueue_script('flowgrid-js');
  115. wp_register_script('flowgrid-scripts-js', get_template_directory_uri().'/js/scripts.js',array(), false, true);
  116. wp_enqueue_script('flowgrid-scripts-js');
  117. }
  118. add_action('wp_enqueue_scripts','themolio_enqueue_footer_scripts');
  119. /**
  120. * Add style statements to the head
  121. */
  122. function themolio_enqueue_styles() {
  123. global $themolio_is_mobile;
  124. $style = "";
  125. $style .= '<!--[if IE]> <link rel="stylesheet" type="text/css" media="all" href="'.get_template_directory_uri().'/ie.css" /> <![endif]-->'."\n";
  126. $style .= '<link rel="stylesheet" type="text/css" media="all" href="'.get_template_directory_uri().'/fonts/stylesheet.css" />'."\n";
  127. $style .= '<style type="text/css">'."\n";
  128. $style .= themolio_typography();
  129. $style .= themolio_background_color_styling();
  130. $style .= '</style>'."\n";
  131. if($themolio_is_mobile)
  132. $style .= '<link rel="stylesheet" type="text/css" media="all" href="'.get_template_directory_uri().'/mobile.css" />'."\n";
  133. echo $style;
  134. }
  135. add_action('wp_head','themolio_enqueue_styles');
  136. /**
  137. * Custom Typography Styling
  138. */
  139. function themolio_typography() {
  140. global $themolio_options;
  141. $style = "";
  142. $style .= "\t".'body, #cancel-comment-reply-link { font-family: '.$themolio_options['content_font'].'; }'."\n";
  143. $style .= "\t".'.entry-content, .widget, #author-info, .entry-utility, .comment-meta, .comment-content, .pingback-content, #respond, .nocomments, .nopassword { color: #'.$themolio_options['font_color'].'; font-size: '.$themolio_options['font_size'].'%; }'."\n";
  144. $style .= "\t".'.entry-meta a, .entry-content a, .widget a, #author-info a, .entry-utility a, #crumbs a:hover, .comments-write-link a, .comment-meta a, .comment-content a, .pingback-content a, #respond a { color: #'.$themolio_options['link_color'].'; }'."\n";
  145. $style .= "\t".'.more-link:hover, .page-link a:hover span, .page-link span, .navigation a:hover, .navigation .current, .single-navigation span a:hover, .tagcloud a:hover { text-decoration: none; background-color: #'.$themolio_options['button_color'].'; text-shadow: #'.themolio_color_darken($themolio_options['button_color'],50).' 1px 1px !important; border-color: #'.themolio_color_darken($themolio_options['button_color'],50).'; }'."\n";
  146. $style .= "\t".'input[type="submit"], input[type="reset"], input[type="button"] { background-color: #'.$themolio_options['button_color'].'; text-shadow: #'.themolio_color_darken($themolio_options['button_color'],50).' 1px 1px !important; border-color: #'.themolio_color_darken($themolio_options['button_color'],50).'; }'."\n";
  147. $style .= "\t".'input[type="submit"]:hover, input[type="reset"]:hover, input[type="button"]:hover { background-color: #'.themolio_color_darken($themolio_options['button_color'],30).'; text-shadow: #'.themolio_color_darken($themolio_options['button_color'],80).' 1px 1px !important; border-color: #'.themolio_color_darken($themolio_options['button_color'],80).'; }'."\n";
  148. return $style;
  149. }
  150. /**
  151. * Border color adjustment based on background color
  152. */
  153. function themolio_background_color_styling() {
  154. global $themolio_options;
  155. $bgcolor = get_theme_mod('background_color');
  156. $bgimage = get_theme_mod('background_image');
  157. $style = '';
  158. if((trim($bgcolor) != '' and trim($bgimage) != '') or (trim($bgcolor) != '' and trim($bgimage) == '')) {
  159. $style .= "\t".'article.post, article.page, article.type-attachment, .widget, #crumbs, .navigation a, .single-navigation span a, .comment-title-container, .commentlist li, #respond, .nocomments, .nopassword { border-color: #'.themolio_color_darken($bgcolor,30).'; }'."\n";
  160. } else if(trim($bgimage) != '' and trim($bgcolor) == '') {
  161. $style .= "\t".'article.post, article.page, article.type-attachment, .widget, #crumbs, .navigation a, .single-navigation span a, .comment-title-container, .commentlist li, #respond, .nocomments, .nopassword { border-color: #222; }'."\n";
  162. }
  163. return $style;
  164. }
  165. /**
  166. * Setting global variable to maintain the count of items in the grid
  167. * Do not modify this function
  168. */
  169. $themolio_grid_item_count = 1;
  170. function themolio_grid_item_count_incr() {
  171. global $themolio_grid_item_count;
  172. $themolio_grid_item_count++;
  173. }
  174. function themolio_grid_col_class() {
  175. global $themolio_options;
  176. if($themolio_options['grid_columns'] == 2)
  177. echo ' grid-col-2';
  178. elseif($themolio_options['grid_columns'] == 3)
  179. echo ' grid-col-3';
  180. elseif($themolio_options['grid_columns'] == 4)
  181. echo ' grid-col-4';
  182. }
  183. /**
  184. * Register sidebars and widgetized areas
  185. */
  186. function themolio_widgets_init() {
  187. register_sidebar(array(
  188. 'name' => __('Main Sidebar', 'themolio'),
  189. 'id' => 'sidebar-1',
  190. 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  191. 'after_widget' => "</aside>",
  192. 'before_title' => '<h3 class="widget-title">',
  193. 'after_title' => '</h3>',
  194. ));
  195. }
  196. add_action('widgets_init', 'themolio_widgets_init');
  197. /**
  198. * Prints HTML with meta information for the current post-date/time and author.
  199. * Create your own themolio_posted_on to override in a child theme
  200. */
  201. if (!function_exists('themolio_posted_on')):
  202. function themolio_posted_on() {
  203. printf(__('<span class="entry-date">Posted on <a href="%1$s" title="%2$s" rel="bookmark">%3$s</a> </span><span class="entry-author">By <a href="%4$s" title="%5$s" rel="author">%6$s</a></span>', 'themolio' ),
  204. esc_url(get_permalink()),
  205. esc_attr(get_the_time()),
  206. esc_html(get_the_date()),
  207. esc_url(get_author_posts_url(get_the_author_meta('ID'))),
  208. esc_attr(sprintf(__('View all posts by %s', 'themolio'), get_the_author())),
  209. get_the_author()
  210. );
  211. ?>
  212. <?php edit_post_link(__('Edit','themolio'), '<span class="edit-link">', '</span>'); ?>
  213. <?php
  214. }
  215. endif;
  216. /**
  217. * Sets the post excerpt length to 40 words.
  218. *
  219. * To override this length in a child theme, remove the filter and add your own
  220. * function tied to the excerpt_length filter hook.
  221. */
  222. function themolio_excerpt_length($length) {
  223. return 40;
  224. }
  225. add_filter('excerpt_length', 'themolio_excerpt_length');
  226. /**
  227. * Returns a "Continue Reading" link for excerpts
  228. */
  229. function themolio_continue_reading_link() {
  230. return '<p><a class="more-link" href="'.esc_url(get_permalink()).'">'.__('Continue reading', 'themolio').'</a></p>';
  231. }
  232. /**
  233. * Replaces "[...]" (appended to automatically generated excerpts) with a themolio_continue_reading_link().
  234. *
  235. * To override this in a child theme, remove the filter and add your own
  236. * function tied to the excerpt_more filter hook.
  237. */
  238. function themolio_auto_excerpt_more($more) {
  239. return themolio_continue_reading_link();
  240. }
  241. add_filter('excerpt_more', 'themolio_auto_excerpt_more');
  242. /**
  243. * Adds a pretty "Continue Reading" link to custom post excerpts.
  244. *
  245. * To override this link in a child theme, remove the filter and add your own
  246. * function tied to the get_the_excerpt filter hook.
  247. */
  248. function themolio_custom_excerpt_more( $output ) {
  249. if(has_excerpt() && !is_attachment()) {
  250. $output .= themolio_continue_reading_link();
  251. }
  252. return $output;
  253. }
  254. add_filter('get_the_excerpt', 'themolio_custom_excerpt_more');
  255. /**
  256. * Create pagination link for posts
  257. */
  258. function themolio_get_pagination($range = 4){
  259. global $paged, $wp_query;
  260. $max_page = 0;
  261. if (!$max_page) {
  262. $max_page = $wp_query->max_num_pages;
  263. }
  264. if($max_page > 1){
  265. echo '<div class="navigation clearfix">'."\n";
  266. if(!$paged){
  267. $paged = 1;
  268. }
  269. if($paged != 1){
  270. echo "<a href=".get_pagenum_link(1).">".__('First','themolio')."</a>";
  271. }
  272. previous_posts_link(' &laquo; ');
  273. if($max_page > $range){
  274. if($paged < $range){
  275. for($i = 1; $i <= ($range + 1); $i++){
  276. echo "<a href='".get_pagenum_link($i) ."'";
  277. if($i==$paged) echo " class='current'";
  278. echo ">".number_format_i18n($i)."</a>";
  279. }
  280. }
  281. elseif($paged >= ($max_page - ceil(($range/2)))){
  282. for($i = $max_page - $range; $i <= $max_page; $i++){
  283. echo "<a href='".get_pagenum_link($i) ."'";
  284. if($i==$paged) echo " class='current'";
  285. echo ">".number_format_i18n($i)."</a>";
  286. }
  287. }
  288. elseif($paged >= $range && $paged < ($max_page - ceil(($range/2)))){
  289. for($i = ($paged - ceil($range/2)); $i <= ($paged + ceil(($range/2))); $i++){
  290. echo "<a href='".get_pagenum_link($i) ."'";
  291. if($i==$paged) echo " class='current'";
  292. echo ">".number_format_i18n($i)."</a>";
  293. }
  294. }
  295. }
  296. else{
  297. for($i = 1; $i <= $max_page; $i++){
  298. echo "<a href='".get_pagenum_link($i) ."'";
  299. if($i==$paged) echo " class='current'";
  300. echo ">".number_format_i18n($i)."</a>";
  301. }
  302. }
  303. next_posts_link(' &raquo; ');
  304. if($paged != $max_page){
  305. echo " <a href=".get_pagenum_link($max_page).">".__('Last','themolio')."</a>";
  306. }
  307. echo '</div>'."\n";
  308. }
  309. }
  310. /**
  311. * Displays breadcrumbs
  312. */
  313. function themolio_breadcrumbs() {
  314. $delimiter = '<span class="sep">&raquo;</span>';
  315. $home = __('Home','themolio'); // text for the 'Home' link
  316. $before = '<span class="current">'; // tag before the current crumb
  317. $after = '</span>'; // tag after the current crumb
  318. if (!is_home() && !is_front_page() || is_paged()) {
  319. echo '<div id="crumbs">';
  320. global $post;
  321. $homeLink = home_url();
  322. echo '<a href="'.$homeLink.'">'.$home.'</a> '.$delimiter.' ';
  323. if (is_category()) {
  324. global $wp_query;
  325. $cat_obj = $wp_query->get_queried_object();
  326. $thisCat = $cat_obj->term_id;
  327. $thisCat = get_category($thisCat);
  328. $parentCat = get_category($thisCat->parent);
  329. if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' '.$delimiter.' '));
  330. echo $before.__('Archive by category','themolio').' "'.single_cat_title('', false).'"'.$after;
  331. } elseif (is_day()) {
  332. echo '<a href="'.get_year_link(get_the_time('Y')).'">'.get_the_time('Y').'</a> '.$delimiter.' ';
  333. echo '<a href="'.get_month_link(get_the_time('Y'),get_the_time('m')).'">'.get_the_time('F').'</a> '.$delimiter.' ';
  334. echo $before.get_the_time('d').$after;
  335. } elseif (is_month()) {
  336. echo '<a href="'.get_year_link(get_the_time('Y')).'">'.get_the_time('Y').'</a> '.$delimiter.' ';
  337. echo $before.get_the_time('F').$after;
  338. } elseif (is_year()) {
  339. echo $before.get_the_time('Y').$after;
  340. } elseif (is_single() && !is_attachment()) {
  341. if (get_post_type() != 'post') {
  342. $post_type = get_post_type_object(get_post_type());
  343. $slug = $post_type->rewrite;
  344. echo '<a href="'.$homeLink.'/'.$slug['slug'].'/">'.$post_type->labels->singular_name.'</a> '.$delimiter.' ';
  345. echo $before.get_the_title().$after;
  346. } else {
  347. $cat = get_the_category(); $cat = $cat[0];
  348. echo get_category_parents($cat, TRUE, ' '.$delimiter.' ');
  349. echo $before.get_the_title().$after;
  350. }
  351. } elseif (is_attachment()) {
  352. $parent = get_post($post->post_parent);
  353. $cat = get_the_category($parent->ID); $cat = $cat[0];
  354. echo get_category_parents($cat, TRUE, ' '.$delimiter.' ');
  355. echo '<a href="'.get_permalink($parent).'">'.$parent->post_title.'</a> '.$delimiter.' ';
  356. echo $before.get_the_title().$after;
  357. } elseif (is_page() && !$post->post_parent) {
  358. echo $before.get_the_title().$after;
  359. } elseif (is_page() && $post->post_parent) {
  360. $parent_id = $post->post_parent;
  361. $breadcrumbs = array();
  362. while ($parent_id) {
  363. $page = get_page($parent_id);
  364. $breadcrumbs[] = '<a href="'.get_permalink($page->ID).'">'.get_the_title($page->ID).'</a>';
  365. $parent_id = $page->post_parent;
  366. }
  367. $breadcrumbs = array_reverse($breadcrumbs);
  368. foreach ($breadcrumbs as $crumb) echo $crumb.' '.$delimiter.' ';
  369. echo $before.get_the_title().$after;
  370. } elseif (is_search()) {
  371. echo $before.__('Search results for','themolio').' "'.get_search_query().'"'.$after;
  372. } elseif (is_tag()) {
  373. echo $before.__('Posts tagged','themolio').' "'.single_tag_title('', false).'"'.$after;
  374. } elseif (is_author()) {
  375. global $author;
  376. $userdata = get_userdata($author);
  377. echo $before.__('Articles posted by','themolio').' '.$userdata->display_name.$after;
  378. } elseif (is_404()) {
  379. echo $before.__('Error 404','themolio').' '. $after;
  380. }
  381. if (get_query_var('paged')) {
  382. if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) echo ' (';
  383. echo __('Page','themolio').' '.get_query_var('paged');
  384. if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) echo ')';
  385. }
  386. echo '</div>';
  387. }
  388. }
  389. /**
  390. * Displays Author's description on Single post templates
  391. */
  392. function themolio_post_author_info() {
  393. global $themolio_options;
  394. // If a user has filled out their description and this is a multi-author blog, show a bio on their entries
  395. if(get_the_author_meta('description') && (!function_exists('is_multi_author') || is_multi_author())) {
  396. ?>
  397. <div id="author-info" class="clearfix">
  398. <div id="author-avatar">
  399. <?php echo get_avatar(get_the_author_meta('user_email'), apply_filters('themolio_author_bio_avatar_size', 48)); ?>
  400. </div>
  401. <div id="author-description">
  402. <h3><?php printf(__('About %s', 'themolio'), get_the_author()); ?></h3>
  403. <p><?php the_author_meta('description'); ?></p>
  404. <p>
  405. <a href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>" rel="author"><?php printf(__('View all posts by %s <span class="meta-nav">&rarr;</span>', 'themolio'), get_the_author()); ?></a>
  406. </p>
  407. </div>
  408. </div>
  409. <?php
  410. }
  411. }
  412. /**
  413. * Prints HTML with post category and tags.
  414. */
  415. function themolio_utility() {
  416. global $themolio_options;
  417. $utility_text = "";
  418. $categories_list = get_the_category_list(__(', ', 'themolio'));
  419. $tag_list = get_the_tag_list('', __(', ', 'themolio'));
  420. if($categories_list != "")
  421. $utility_text .= '<p><span class="utility-title">'.__('Posted under: ','themolio').'</span>'.$categories_list.'</p>';
  422. if($tag_list != "")
  423. $utility_text .= '<p><span class="utility-title">'.__('Tagged as: ','themolio').'</span>'.$tag_list.'</p>';
  424. if($utility_text != "" and $themolio_options['show_single_utility']) {
  425. echo '<div class="entry-utility">';
  426. echo $utility_text;
  427. echo '</div>';
  428. }
  429. }
  430. /**
  431. * Outputs pages in dropdown (used for mobile displays)
  432. */
  433. function themolio_pages_dropdown() {
  434. ?>
  435. <select id="themolio_page_dropdown" name="themolio_page_dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
  436. <option value=""><?php _e('Select page','themolio'); ?></option>
  437. <?php
  438. $pages = get_pages();
  439. foreach ($pages as $page) {
  440. $option = '<option value="'.get_page_link($page->ID).'">';
  441. $option .= $page->post_title;
  442. $option .= '</option>';
  443. echo $option;
  444. }
  445. ?>
  446. </select>
  447. <?php
  448. }
  449. /**
  450. * Function to return darker color shade
  451. */
  452. function themolio_color_darken($color, $dif=80){
  453. $color = str_replace('#', '', $color);
  454. if (strlen($color) != 6){ return '000000'; }
  455. $rgb = '';
  456. for ($x=0;$x<3;$x++){
  457. $c = hexdec(substr($color,(2*$x),2)) - $dif;
  458. $c = ($c < 0) ? 0 : dechex($c);
  459. $rgb .= (strlen($c) < 2) ? '0'.$c : $c;
  460. }
  461. return $rgb;
  462. }
  463. if(!function_exists('themolio_comment')):
  464. /**
  465. * Template for comments and pingbacks.
  466. *
  467. * To override this walker in a child theme without modifying the comments template
  468. * simply create your own themolio_comment(), and that function will be used instead.
  469. *
  470. * Used as a callback by wp_list_comments() for displaying the comments.
  471. */
  472. function themolio_comment($comment, $args, $depth) {
  473. $GLOBALS['comment'] = $comment;
  474. switch($comment->comment_type):
  475. case 'pingback':
  476. case 'trackback':
  477. ?>
  478. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  479. <article id="comment-<?php comment_ID(); ?>" class="pingback">
  480. <div class="pingback-content">
  481. <?php _e('Pingback:', 'themolio'); ?> <?php comment_author_link(); ?><?php edit_comment_link(__('Edit', 'themolio'), '<p class="pingback-edit-link">', '</p>'); ?>
  482. </div>
  483. </article>
  484. <?php
  485. break;
  486. default:
  487. ?>
  488. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  489. <article id="comment-<?php comment_ID(); ?>" class="comment">
  490. <div class="comment-meta">
  491. <table class="tablayout"><tr>
  492. <td class="tdleft" style="width:55px;vertical-align:top;"><?php echo get_avatar($comment, '40'); ?></td>
  493. <td class="tdleft" style="vertical-align:top;">
  494. <p class="comment-author"><?php printf(__('<strong>%1$s</strong> on %2$s <span class="says">said:</span>', 'themolio'), sprintf('<span class="fn">%s</span>', get_comment_author_link()), sprintf('<a href="%1$s">%2$s</a>', esc_url(get_comment_link($comment->comment_ID)), sprintf(__('%1$s at %2$s', 'themolio'), get_comment_date(), get_comment_time()))); ?></p>
  495. <?php comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'themolio'), 'before' => '<p class="comment-reply">', 'after' => '</p>', 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?>
  496. <?php edit_comment_link( __('Edit', 'themolio'), '<p class="edit-link">', '</p>'); ?>
  497. <?php if($comment->comment_approved == '0'): ?>
  498. <p class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.', 'themolio'); ?></p>
  499. <?php endif; ?>
  500. </td>
  501. </tr></table>
  502. </div>
  503. <div class="comment-content"><?php comment_text(); ?></div>
  504. </article>
  505. <?php
  506. break;
  507. endswitch;
  508. }
  509. endif;
  510. function themolio_is_mobile() {
  511. $useragent = $_SERVER['HTTP_USER_AGENT'];
  512. if(preg_match('/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|meego.+mobile|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4)))
  513. return true;
  514. else
  515. return false;
  516. }
  517. ?>