post_content; if ( strlen($truncate) <= $amount ) $echo_out = ''; else $echo_out = '...'; $truncate = apply_filters('the_content', $truncate); $truncate = preg_replace('@]*?>.*?@si', '', $truncate); $truncate = preg_replace('@]*?>.*?@si', '', $truncate); $truncate = strip_tags($truncate); if ($echo_out == '...') $truncate = substr($truncate, 0, strrpos(substr($truncate, 0, $amount), ' ')); else $truncate = substr($truncate, 0, $amount); if ($echo) echo $truncate,$echo_out; else return ($truncate . $echo_out); } /*this function truncates titles to create preview excerpts*/ function truncate_title($amount,$echo=true) { $truncate = get_the_title(); if ( strlen($truncate) <= $amount ) $echo_out = ''; else $echo_out = '...'; $truncate = mb_substr( $truncate, 0, $amount, 'UTF-8' ); if ($echo) { echo $truncate; echo $echo_out; } else { return ($truncate . $echo_out); } } /* this function gets thumbnail from Post Thumbnail or Custom field or First post image */ function get_thumbnail($width=100, $height=100, $class='', $alttext='', $titletext='', $fullpath=false, $custom_field='') { global $post, $shortname, $posts; $thumb_array['thumb'] = ''; $thumb_array['use_timthumb'] = true; if ($fullpath) $thumb_array['fullpath'] = ''; //full image url for lightbox if ( function_exists('has_post_thumbnail') ) { if ( has_post_thumbnail() ) { $thumb_array['use_timthumb'] = false; $args=''; if ($class <> '') $args['class'] = $class; if ($alttext <> '') $args['alt'] = $alttext; if ($titletext <> '') $args['title'] = $titletext; $thumb_array['thumb'] = get_the_post_thumbnail( $post->ID, array($width,$height), $args ); if ($fullpath) { $thumb_array['fullpath'] = get_the_post_thumbnail( $post->ID ); $thumb_array['fullpath'] = preg_match_all('//i', $thumb_array['fullpath'], $matches); $thumb_array['fullpath'] = $matches[1][0]; }; } }; if ($thumb_array['thumb'] == '') { if ($custom_field == '') $thumb_array['thumb'] = get_post_meta($post->ID, 'Thumbnail', $single = true); else { $thumb_array['thumb'] = get_post_meta($post->ID, $custom_field, $single = true); if ($thumb_array['thumb'] == '') $thumb_array['thumb'] = get_post_meta($post->ID, 'Thumbnail', $single = true); } if (($thumb_array['thumb'] == '') && ((get_option($shortname.'_grab_image')) == 'on')) $thumb_array['thumb'] = first_image(); if ($fullpath) $thumb_array['fullpath'] = $thumb_array['thumb']; }; return $thumb_array; } /* this function prints thumbnail from Post Thumbnail or Custom field or First post image */ function print_thumbnail($thumbnail = '', $use_timthumb = true, $alttext = '', $width = 100, $height = 100, $class = '', $echoout = true, $forstyle = false) { $output = ''; if ($forstyle === false) { if ($use_timthumb === false) { $output = $thumbnail; } else { $thumbnail = '/images/sample_image.gif'; $output = ' '') $output .= " class='$class' "; $output .= " alt='$alttext' width='$width' height='$height' />"; }; } else { $output = $thumbnail; if ($use_timthumb === false) { $output = preg_match_all('//i', $output, $matches); $output = $matches[1][0]; } else { $output = get_bloginfo('stylesheet_directory').'/timthumb.php?src='.$output.'&h='.$height.'&w='.$width.'&q=80&zc=1'; } }; if ($echoout) echo $output; else return $output; } function content($num) { $theContent = get_the_content(); $theContent .= " "; $limit = $num+1; $content = explode(' ', $theContent, $limit); array_pop($content); if(sizeof($content)>=100) $content = implode(" ",$content)."..."; else $content = implode(" ",$content); echo $content; } function string_limit_words($string, $word_limit) { $words = explode(' ', $string, ($word_limit + 1)); if(count($words) > $word_limit) array_pop($words); return implode(' ', $words); } add_theme_support( 'post-thumbnails' ); /* Adds jquery 1.3.2 for wordpress < 2.8 */ function jquery_script(){ if ((substr($GLOBALS['wp_version'],0,3)) >= 2.8) { wp_enqueue_script('jquery'); } else { wp_deregister_script('jquery'); wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', false, '1.3.2'); } }; add_action('wp_print_scripts', 'jquery_script',8); /* --------------------------------------------- */ class ControlPanel { var $default_settings = array( 'contentSliderCatId' => '1', 'aboutusPageId' => '2', 'collumnSetting' => 'three', 'firstCatId' => '2', 'secondCatId' => '3', 'thirdCatId' => '4', 'footerRight' => '5', 'footerLeft' => '6', ); var $options; function ControlPanel() { add_action('admin_menu', array(&$this, 'add_menu')); add_action('admin_head', array(&$this, 'admin_head')); if (!is_array(get_option('Corporate Identity'))) add_option('Corporate Identity', $this->default_settings); $this->options = get_option('Corporate Identity'); } function add_menu() { add_theme_page('Theme Settings', 'Blue - Corporate - Hyve Theme Settings','edit_themes', 'Corporate Identity', array(&$this,'optionsmenu')); } function admin_head() { echo ' '; } function optionsmenu() { if($_POST['ss_action'] == 'save') { $this->options['contentSliderCatId'] = $_POST['content_slider_catid']; $this->options['aboutusPageId'] = $_POST['aboutus_page_id']; $this->options['collumnSetting'] = $_POST['collumns']; $this->options['firstCatId'] = $_POST['first_cat_id']; $this->options['secondCatId'] = $_POST['second_cat_id']; $this->options['thirdCatId'] = $_POST['third_cat_id']; $this->options['footerLeft'] = $_POST['footer_left']; $this->options['footerRight'] = $_POST['footer_right']; update_option('Corporate Identity', $this->options); echo '

Corporate Identity settings saved.

'; } if($this->options['collumnSetting']=="three") { $checked = 'checked="checked"'; $checked1 = ''; $style = 'display:block'; } else { $checked = ''; $checked1 = 'checked="checked"'; $style = 'display:none"'; } echo '

Theme Settings

Content Slider


Welcome Text


Column Settings

Two Column      




Footer Columns

'; } } $cpanel = new ControlPanel(); $theme_options = get_option('Corporate Identity'); ?>