'; } add_filter('excerpt_more', 'analytical_lite_excerpt_more'); /******************************************** EXCERPT CONTROLL FUNCTION *********************************************/ function analytical_lite_limit_words($string, $word_limit) { $words = explode(' ', $string); return implode(' ', array_slice($words, 0, $word_limit)); } /******************************************************************* ***************************** pagination *************************** ********************************************************************/ /** Retrieve or display pagination code. * * Usage: * * * */ function analytical_lite_paginate_loop($start, $max, $page = 0) { global $themename, $shortname; $output = ""; for ($i = $start; $i <= $max; $i++) { $output .= ($page === intval($i)) ? "$i" : "$i"; } return $output; } function analytical_lite_pagenavi($args = null) { global $themename, $shortname; $defaults = array( 'page' => null, 'pages' => null, 'range' => 3, 'gap' => 3, 'anchor' => 1, 'before' => '
', 'after' => '
', 'title' => __('Pages', 'analytical-lite'), 'nextpage' => __('Next ›', 'analytical-lite'), 'previouspage' => __('‹ Previous', 'analytical-lite'), 'echo' => 1 ); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); if (!$page && !$pages) { global $wp_query; $page = get_query_var('paged'); $page = !empty($page) ? intval($page) : 1; $posts_per_page = intval(get_query_var('posts_per_page')); $pages = intval(ceil($wp_query->found_posts / $posts_per_page)); } $output = ""; if ($pages > 1) { $output .= "$before$title"; $ellipsis = "..."; if ($page > 1 && !empty($previouspage)) { $output .= "$previouspage"; } $min_links = $range * 2 + 1; $block_min = min($page - $range, $pages - $min_links); $block_high = max($page + $range, $min_links); $left_gap = (($block_min - $anchor - $gap) > 0) ? true : false; $right_gap = (($block_high + $anchor + $gap) < $pages) ? true : false; if ($left_gap && !$right_gap) { $output .= sprintf('%s%s%s', analytical_lite_paginate_loop(1, $anchor), $ellipsis, analytical_lite_paginate_loop($block_min, $pages, $page) ); } else if ($left_gap && $right_gap) { $output .= sprintf('%s%s%s%s%s', analytical_lite_paginate_loop(1, $anchor), $ellipsis, analytical_lite_paginate_loop($block_min, $block_high, $page), $ellipsis, analytical_lite_paginate_loop(($pages - $anchor + 1), $pages) ); } else if ($right_gap && !$left_gap) { $output .= sprintf('%s%s%s', analytical_lite_paginate_loop(1, $block_high, $page), $ellipsis, analytical_lite_paginate_loop(($pages - $anchor + 1), $pages) ); } else { $output .= analytical_lite_paginate_loop(1, $pages, $page); } if ($page < $pages && !empty($nextpage)) { $output .= "$nextpage"; } $output .= $after; } if ($echo) { echo $output; } return $output; } /******* theme check fix ***********/ if ( ! isset( $content_width ) ){ $content_width = 900; } /************************************************** * * Function for selecting contact us page * **************************************************/ function analytical_lite_select_template($pg_id) { //deleting previous postmeta global $wpdb; $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '_wp_page_template' AND meta_value = 'contact-page.php'"); //updating postmeta update_post_meta($pg_id, '_wp_page_template', 'contact-page.php'); } /********************************************* * * to check if a page template is active * *********************************************/ function analytical_lite_is_pagetemplate_active($pagetemplate = '') { global $wpdb; $sql = "select meta_key from $wpdb->postmeta where meta_key like '_wp_page_template' and meta_value like '" . $pagetemplate . "'"; $result = $wpdb->query($sql); if ($result){ return TRUE; } else{ return FALSE; } } /***************************/ function analytical_lite_striptag($tag,$string){ $string=preg_replace('/<'.$tag.'[^>]*>/i', '', $string); $string=preg_replace('/<\/'.$tag.'>/i', '', $string); return $string; } /***************************/ function analytical_lite_header_stylingopt() { global $shortname; ?>