|
@@ -12,16 +12,16 @@ function dw_page_title() {
|
|
|
}
|
|
|
endif;
|
|
|
|
|
|
-if ( ! function_exists( 'dw_page_desc') ) :
|
|
|
-function dw_page_desc() {
|
|
|
+if ( ! function_exists( 'dw_meta_desc') ) :
|
|
|
+function dw_meta_desc() {
|
|
|
global $post;
|
|
|
$post = get_post( $post );
|
|
|
setup_postdata( $post );
|
|
|
- $excerpt = dw_good_excerpt(115);
|
|
|
- if (is_single()||is_page()){
|
|
|
- if (get_post_meta($post->ID, "meta-desc", true) !='' )
|
|
|
- echo get_post_meta($post->ID, "meta-desc", true);
|
|
|
- else echo $excerpt;
|
|
|
+ $meta_excerpt = dw_good_excerpt(115);
|
|
|
+ if ( is_single() || is_page() ) {
|
|
|
+ if ( get_post_meta($post->ID, 'meta-desc', true) ) {
|
|
|
+ echo get_post_meta($post->ID, 'meta-desc', true);
|
|
|
+ } else $meta_excerpt;
|
|
|
}
|
|
|
}
|
|
|
endif;
|
|
@@ -38,8 +38,11 @@ function dw_good_excerpt($length) {
|
|
|
$text = strip_shortcodes($text);
|
|
|
$text = strip_tags($text);
|
|
|
$text = substr($text,0,$length);
|
|
|
+ if ( strlen($text) < 10 ) {
|
|
|
+ $text = the_title('', ' - ', false);
|
|
|
+ }
|
|
|
$allowed_end = array('.', '!', '?', '...');
|
|
|
- $excerpt = reverse_strrchr($text, '.', 1);
|
|
|
+ $excerpt = reverse_strrchr($text, '.', 2);
|
|
|
if( $excerpt ) {
|
|
|
echo apply_filters('get_the_excerpt',$excerpt);
|
|
|
} else {
|