From 8a6efdc1a0f984a821605fa94dd4c28d283396ce Mon Sep 17 00:00:00 2001 From: Alex Corbi Date: Mon, 19 Jun 2017 18:56:54 +0200 Subject: [PATCH 1/5] passing post id to get_the_tags --- inc/utils/content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/utils/content.php b/inc/utils/content.php index 0dbc0942..8a1aa382 100644 --- a/inc/utils/content.php +++ b/inc/utils/content.php @@ -414,7 +414,7 @@ function echo_post_meta($the_post, $show_elements = array('date','categories','t ID); if (isset($max_num_tags) && $max_num_tags > 0): $tag_list = array_splice($tag_list,0,$max_num_tags); endif; From c8b8236da033b1e3ac642112a59165a670920858 Mon Sep 17 00:00:00 2001 From: huyeng Date: Tue, 20 Jun 2017 17:31:15 +0700 Subject: [PATCH 2/5] Fixes odm_excerpt() that chopped string in English and Khmer --- inc/utils/content.php | 46 +++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/inc/utils/content.php b/inc/utils/content.php index 0dbc0942..a0648ac2 100644 --- a/inc/utils/content.php +++ b/inc/utils/content.php @@ -444,37 +444,45 @@ function echo_post_meta($the_post, $show_elements = array('date','categories','t } -function odm_excerpt($the_post, $num = 400, $read_more = '') +function odm_excerpt($the_post, $num = 40, $read_more = '') { global $post; $post = $the_post; $limit = $num; - $chopped = false; - - if (odm_language_manager()->get_current_language() == "km"): - $limit = $limit * 4; + + if($post->post_excerpt): + $post_content = $post->post_excerpt; + else: + $post_content = strip_tags(apply_filters('the_content',$post->post_content)); endif; - $post_content = apply_filters('the_content',$post->post_content); - $translated_content = apply_filters('translate_text',$post_content, odm_language_manager()->get_current_language()); + $translated_content = apply_filters('translate_text', $post_content, odm_language_manager()->get_current_language()); $stripped_content = strip_tags($translated_content); $stripped_content = strip_shortcodes($stripped_content); - $excerpt_hidden_space = explode("​", $stripped_content); //explode by zerowidthspace​ - $excerpt_string = implode("​", $excerpt_hidden_space); //implode by zerowidthspace - $excerpt_words = $excerpt_string; + if($stripped_content){ + $stripped_content = preg_replace( "/\…/",'', trim($stripped_content)); + $stripped_content_arr = explode(' ', trim($stripped_content), $num+1); - if (strlen($excerpt_words) > $limit): - $excerpt_words = substr($excerpt_words,0,$limit); - $excerpt_words .= "..."; - endif; + if($stripped_content_arr): + array_splice($stripped_content_arr, $limit); + $excerpt_content = implode(' ', $stripped_content_arr); + if (odm_language_manager()->get_current_language() == "km"): + $excerpt_zeo_space = explode("​", $excerpt_content, $limit); //explode by zerowidthspace​ + $excerpt_content = implode("​", $excerpt_zeo_space); //implode by zerowidthspace + endif; - if (!empty($read_more)): - $color_name = odm_country_manager()->get_current_country().'-color'; - $excerpt_words .= " ".__($read_more, 'odm').''; - endif; + $excerpt_words = $excerpt_content.' ...'; + + if ($read_more != '') { + $color_name = odm_country_manager()->get_current_country().'-color'; + $excerpt_words .= " (".__($read_more, 'odm').')'; + } + return '

' . $excerpt_words . '

'; + endif; + } - return '

' . $excerpt_words . '

'; + return; } function echo_post_translated_by_od_team($postID, $current_lang = "en", $taxonomy ="language") { From da5e9e6c6e1b8592177bdcedcd2e9d046d5d1a5d Mon Sep 17 00:00:00 2001 From: Alex Corbi Date: Tue, 20 Jun 2017 19:55:07 +0200 Subject: [PATCH 3/5] better styling for suggestions --- less/_search.less | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/less/_search.less b/less/_search.less index fe6018a2..dbcab64c 100644 --- a/less/_search.less +++ b/less/_search.less @@ -162,10 +162,6 @@ padding: 0px !important; } -.ui-widget-content { - border: 0px !important; -} - .ui-state-default { background: #f0f0f0 !important; border: 0px !important; @@ -173,7 +169,7 @@ } .ui-state-hover, .ui-state-focus { - background: #c8c8c8 !important; + background: @light-gray !important; border: 0px !important; color: @gray; } From 9cf2f8b71fff46eed0c0b512defa275190e28cc4 Mon Sep 17 00:00:00 2001 From: Alex Corbi Date: Wed, 21 Jun 2017 10:19:43 +0200 Subject: [PATCH 4/5] Fixes #1026 --- inc/utils/content.php | 10 +++++----- style.css | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/inc/utils/content.php b/inc/utils/content.php index a0648ac2..26b059ad 100644 --- a/inc/utils/content.php +++ b/inc/utils/content.php @@ -460,7 +460,7 @@ function odm_excerpt($the_post, $num = 40, $read_more = '') $stripped_content = strip_tags($translated_content); $stripped_content = strip_shortcodes($stripped_content); - if($stripped_content){ + if($stripped_content): $stripped_content = preg_replace( "/\…/",'', trim($stripped_content)); $stripped_content_arr = explode(' ', trim($stripped_content), $num+1); @@ -474,15 +474,15 @@ function odm_excerpt($the_post, $num = 40, $read_more = '') $excerpt_words = $excerpt_content.' ...'; - if ($read_more != '') { + if ($read_more != ''): $color_name = odm_country_manager()->get_current_country().'-color'; $excerpt_words .= " (".__($read_more, 'odm').')'; - } + endif; return '

' . $excerpt_words . '

'; endif; - } + endif; - return; + return $stripped_content; } function echo_post_translated_by_od_team($postID, $current_lang = "en", $taxonomy ="language") { diff --git a/style.css b/style.css index f6b30675..b2848fb5 100644 --- a/style.css +++ b/style.css @@ -5,7 +5,7 @@ Author: Open Development Mekong Author URI: http://github.com/OpenDevelopmentMekong Description: Open Development Mekong's wordpress theme. Based on JEO child theme Template: jeo -Version: 2.2.57 +Version: 2.2.58 License: GNU General Public License v3 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html */ From 75710449527739158a0c55bb1d9b98de4cddd68f Mon Sep 17 00:00:00 2001 From: Alex Corbi Date: Wed, 21 Jun 2017 10:21:04 +0200 Subject: [PATCH 5/5] small improvement on odm_excerpt --- inc/utils/content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/utils/content.php b/inc/utils/content.php index f0871b4b..0de67564 100644 --- a/inc/utils/content.php +++ b/inc/utils/content.php @@ -482,7 +482,7 @@ function odm_excerpt($the_post, $num = 40, $read_more = '') endif; endif; - return $stripped_content; + return '

' . $stripped_content . '

'; } function echo_post_translated_by_od_team($postID, $current_lang = "en", $taxonomy ="language") {