0) { $string = substr($string, 0, $substr); } if(strlen($excerpt)>=$substr){ $string .= $strmore; } return $string; } } // The excerpt based on words if(!function_exists("klasik_string_limit_words")){ function klasik_string_limit_words($string, $word_limit){ $words = explode(' ', $string, ($word_limit + 1)); if(count($words) > $word_limit) array_pop($words); return implode(' ', $words); } } if(!function_exists("klasik_get_category")){ function klasik_get_category(){ global $post; $categories = get_the_category(); $separator = ', '; $catoutput = ''; if($categories){ foreach($categories as $category) { $catoutput .= 'name ) ) . '">'.$category->cat_name.''.$separator; } } return trim($catoutput, $separator); } } if( !function_exists('klasik_is_pagepost')){ function klasik_is_pagepost(){ global $post; if( is_404() || is_archive() || is_attachment() || is_search() ){ $custom = false; }else{ $custom = true; } return $custom; } } if( !function_exists('klasik_get_customdata')){ function klasik_get_customdata($pid=""){ global $post; if($pid!=""){ $custom = get_post_custom($pid); }elseif( klasik_is_pagepost() ){ $custom = get_post_custom(get_the_ID()); }else{ $custom = array(); } return $custom; } } if( !function_exists('klasik_get_imgsize')){ function klasik_get_imgsize(){ global $imgconf; $defaultimg = klasik_default_image(); $imageconfs = (isset($imgconf) && is_array($imgconf))? $imgconf : array(); $imageconfs = array_merge($defaultimg, $imageconfs); return $imageconfs; } } if( !function_exists('klasik_get_customstyle')){ function klasik_get_customstyle(){ global $customstyles; $defaultimg = klasik_default_styles(); $imageconfs = (isset($customstyles) && is_array($customstyles))? $customstyles : array(); $imageconfs = array_merge($defaultimg, $imageconfs); return $imageconfs; } } if( !function_exists('klasik_get_configval')){ function klasik_get_configval($confstr,$defval=""){ if(defined($confstr)){ $return = constant($confstr); }else{ $return = $defval; } return $return; } } /* Remove inline styles printed when the gallery shortcode is used.*/ function klasik_remove_gallery_css( $css ) { return preg_replace( "##s", '', $css ); } add_filter( 'gallery_style', 'klasik_remove_gallery_css' ); /*Template for comments and pingbacks. */ if ( ! function_exists( 'klasik_comment' ) ) : function klasik_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case '' : ?>
  • id="li-comment-">
    %s', get_comment_author_link() ) ); ?>  $depth, 'max_depth' => $args['max_depth'] ,'reply_text' => '/ Reply') ) ); ?>
    comment_approved == '0' ) : ?>
  • Tags: %2$s', 'klasik' ); } elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) { $posted_in = __( 'Categories: %1$s', 'klasik' ); } else { $posted_in = __( '', 'klasik' ); } // Prints the string, replacing the placeholders. printf( $posted_in, get_the_category_list( ', ' ), $tag_list, get_permalink(), the_title_attribute( 'echo=0' ) ); } endif; if( ! function_exists('klasik_filter_title') ){ function klasik_filter_title($title) { if ($title == '') { return __('Untitled','klasik'); } else { return $title; } } add_filter('the_title', 'klasik_filter_title'); } /* for top menu */ function nav_page_fallback() { if(is_front_page()){$class="current_page_item";}else{$class="";} print ''; } /* for shortcode widget */ add_filter('widget_text', 'do_shortcode'); /* for removing the wpautop */ function klasik_run_shortcode( $content ) { global $shortcode_tags; // Backup current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; // Do the shortcode (only the one above is registered) $content = do_shortcode( $content ); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; return $content; } add_filter( 'the_content', 'klasik_run_shortcode', 7 ); ?>