|
@@ -17,11 +17,15 @@ function dw_meta_desc() {
|
|
global $post;
|
|
global $post;
|
|
$post = get_post( $post );
|
|
$post = get_post( $post );
|
|
setup_postdata( $post );
|
|
setup_postdata( $post );
|
|
- $meta_excerpt = dw_good_excerpt(115);
|
|
|
|
if ( is_single() || is_page() ) {
|
|
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;
|
|
|
|
|
|
+ $meta_desc_value = get_post_meta( $post->ID, 'meta-desc', true );
|
|
|
|
+ if ( $meta_desc_value !== '') {
|
|
|
|
+ echo $meta_desc_value;
|
|
|
|
+ }
|
|
|
|
+ elseif ( $meta_desc_value == '') {
|
|
|
|
+ $meta_excerpt = dw_good_excerpt(115);
|
|
|
|
+ echo $meta_excerpt;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
endif;
|
|
endif;
|
|
@@ -38,7 +42,7 @@ function dw_good_excerpt($length) {
|
|
$text = strip_shortcodes($text);
|
|
$text = strip_shortcodes($text);
|
|
$text = strip_tags($text);
|
|
$text = strip_tags($text);
|
|
$text = substr($text,0,$length);
|
|
$text = substr($text,0,$length);
|
|
- if ( strlen($text) < 10 ) {
|
|
|
|
|
|
+ if ( strlen($text) < 15 ) {
|
|
$text = the_title('', ' - ', false);
|
|
$text = the_title('', ' - ', false);
|
|
}
|
|
}
|
|
$allowed_end = array('.', '!', '?', '...');
|
|
$allowed_end = array('.', '!', '?', '...');
|