'; } add_filter('excerpt_more', 'skt_excerpt_more'); /************* Custom Page Title *********** *******************************************/ add_filter( 'wp_title', 'skt_title' ); function skt_title($title) { $skt_title = $title; if ( is_home() && !is_front_page() ) { $skt_title .= get_bloginfo('name'); } if ( is_front_page() ){ $skt_title .= get_bloginfo('name'); $skt_title .= ' | '; $skt_title .= get_bloginfo('description'); } if ( is_search() ) { $skt_title .= get_bloginfo('name'); } if ( is_author() ) { $skt_title .= get_bloginfo('name'); } if ( is_single() ) { $skt_title .= get_bloginfo('name'); } if ( is_page() && !is_front_page() ) { $skt_title .= get_bloginfo('name'); } if ( is_category() ) { $skt_title .= get_bloginfo('name'); } if ( is_year() ) { $skt_title .= get_bloginfo('name'); } if ( is_month() ) { $skt_title .= get_bloginfo('name'); } if ( is_day() ) { $skt_title .= get_bloginfo('name'); } if (function_exists('is_tag')) { if ( is_tag() ) { $skt_title .= get_bloginfo('name'); } if ( is_404() ) { $skt_title .= get_bloginfo('name'); } } return $skt_title; } /******************************************** EXCERPT CONTROLL FUNCTION *********************************************/ function skt_limit_words($string, $word_limit) { $words = explode(' ', $string); return implode(' ', array_slice($words, 0, $word_limit)); } /******************************************************************* ***************************** pagination *************************** ********************************************************************/ /** Retrieve or display pagination code. * * Usage: * * * */ function skt_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 skt_pagenavi($args = null) { global $themename, $shortname; $defaults = array( 'page' => null, 'pages' => null, 'range' => 3, 'gap' => 3, 'anchor' => 1, 'before' => '
', 'after' => '
', 'title' => __('Pages', 'analytical'), 'nextpage' => __('Next ›', 'analytical'), 'previouspage' => __('‹ Previous', 'analytical'), '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', skt_paginate_loop(1, $anchor), $ellipsis, skt_paginate_loop($block_min, $pages, $page) ); } else if ($left_gap && $right_gap) { $output .= sprintf('%s%s%s%s%s', skt_paginate_loop(1, $anchor), $ellipsis, skt_paginate_loop($block_min, $block_high, $page), $ellipsis, skt_paginate_loop(($pages - $anchor + 1), $pages) ); } else if ($right_gap && !$left_gap) { $output .= sprintf('%s%s%s', skt_paginate_loop(1, $block_high, $page), $ellipsis, skt_paginate_loop(($pages - $anchor + 1), $pages) ); } else { $output .= skt_paginate_loop(1, $pages, $page); } if ($page < $pages && !empty($nextpage)) { $output .= "$nextpage"; } $output .= $after; } if ($echo) { echo $output; } return $output; } /******************************************** Contact Verify ............................. *********************************************/ add_action('wp_ajax_skt-contact-verify', 'skt_contact_verify'); add_action('wp_ajax_nopriv_skt-contact-verify', 'skt_contact_verify'); function skt_contact_verify() { global $themename; global $shortname; //Check to make sure that the name field is not empty if(trim($_POST['contactname']) == '') { $hasError = true; } else { $name = trim($_POST['contactname']); } //Check to make sure that the subject field is not empty if(trim($_POST['subject']) == '') { $hasError = true; } else { $subject = trim($_POST['subject']); } //Check to make sure sure that a valid email address is submitted if(trim($_POST['email']) == '') { $hasError = true; } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) { $hasError = true; } else { $email = trim($_POST['email']); } //Check to make sure comments were entered if(trim($_POST['message']) == '') { $hasError = true; } else { if(function_exists('stripslashes')) { $comments = stripslashes(trim($_POST['message'])); } else { $comments = trim($_POST['message']); } } //extracting to email if(sketch_get_option($shortname.'_contact_email')) $toEmail= sketch_get_option($shortname.'_contact_email'); else $toEmail= get_option('admin_email'); //If there is no error, send the email if(!isset($hasError)) { $site_name = get_bloginfo('name'); $site_url = home_url(); $ip_add = $_SERVER['REMOTE_ADDR']; $emailTo = $toEmail; //Put your own email address here $body = "New message from $name

"; $body .= "Name: $name
Email: $email
Subject: $subject
Message:
$comments"; $body .= "

This mail is sent via contact form on $site_name $site_url from IP Address $ip_add"; $headers = "From: " . $email . "\r\n"; $headers .= "Reply-To: ". $emailTo . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; @mail($emailTo, $subject, $body, $headers); $emailSent = true; _e('Your contact Form has been submitted. Thank you.', 'analytical'); } else { _e("Please check if you've filled all the fields with valid information. Thank you.", "SketchMini"); } die(); } /******* theme check fix ***********/ if ( ! isset( $content_width ) ){ $content_width = 900; } /************************************************* Redirect to Theme setting page after activation **************************************************/ if(is_admin() && isset($_GET['activated']) && $pagenow =='themes.php'){ //Do redirect global $shortname; header( 'Location: '.admin_url().'admin.php?page=options-framework' ) ; } /************************************************** * * Function for selecting contact us page * **************************************************/ function 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 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 ske_striptag($tag,$string){ $string=preg_replace('/<'.$tag.'[^>]*>/i', '', $string); $string=preg_replace('/<\/'.$tag.'>/i', '', $string); return $string; } /***************************/ function skt_header_stylingopt() { global $shortname; ?>