File: /home/t/h/a/thanexcelr/www/wp-content/themes/novellite/inc/custom-function.php
<?php
function NovelLite_theme_support() {
add_theme_support('post-thumbnails');
add_image_size('post_thumbnail', 250, 160, true);
add_image_size('post_thumbnail_front', 340, 250, true);
add_image_size('post_thumbnail_loop', 816, 450, true);
add_theme_support('custom-background', array(
'default-image' => '',
));
}
add_action('after_setup_theme', 'NovelLite_theme_support');
/**
* Pagination
*
*/
function NovelLite_pagination($pages = '', $range = 2) {
$showitems = ($range * 2) + 1;
global $paged;
if (empty($paged))
$paged = 1;
if ($pages == '') {
global $wp_query;
$pages = $wp_query->max_num_pages;
if (!$pages) {
$pages = 1;
}
}
if (1 != $pages) {
echo "<ul class='paging'>";
if ($paged > 2 && $paged > $range + 1 && $showitems < $pages)
echo "<li><a href='" . get_pagenum_link(1) . "'>«</a></li>";
if ($paged > 1 && $showitems < $pages)
echo "<li><a href='" . get_pagenum_link($paged - 1) . "'>‹</a></li>";
for ($i = 1; $i <= $pages; $i++) {
if (1 != $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems )) {
echo ($paged == $i) ? "<li><a href='" . get_pagenum_link($i) . "' class='current' >" . $i . "</a></li>" : "<li><a href='" . get_pagenum_link($i) . "' class='inactive' >" . $i . "</a></li>";
}
}
if ($paged < $pages && $showitems < $pages)
echo "<li><a href='" . get_pagenum_link($paged + 1) . "'>›</a></li>";
if ($paged < $pages - 1 && $paged + $range - 1 < $pages && $showitems < $pages)
echo "<li><a href='" . get_pagenum_link($pages) . "'>»</a></li>";
echo "</ul>\n";
}
}
function NovelLite_isMobile() {
return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);
}
?>