Skip to content

Commit

Permalink
Merge pull request #1030 from OpenDevelopmentMekong/master
Browse files Browse the repository at this point in the history
merging to prod for releasing v2.2.58
  • Loading branch information
Alex Corbi authored Jun 22, 2017
2 parents c463f62 + 7571044 commit 9f1f318
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
46 changes: 27 additions & 19 deletions inc/utils/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ function echo_post_meta($the_post, $show_elements = array('date','categories','t
<?php
if (in_array('tags',$show_elements)): ?>
<?php
$tag_list = get_the_tags();
$tag_list = get_the_tags($post->ID);
if (isset($max_num_tags) && $max_num_tags > 0):
$tag_list = array_splice($tag_list,0,$max_num_tags);
endif;
Expand Down Expand Up @@ -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( "/\&hellip;/",'', 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 .= " <a href='".get_permalink($post->ID)." ' class='".$color_name."'>".__($read_more, 'odm').'</a>';
$excerpt_words = $excerpt_content.' ...';

if ($read_more != ''):
$color_name = odm_country_manager()->get_current_country().'-color';
$excerpt_words .= " (<a href='".get_permalink($post->ID)." ' class='".$color_name."'>".__($read_more, 'odm').'</a>)';
endif;
return '<p>' . $excerpt_words . '</p>';
endif;
endif;

return '<p>' . $excerpt_words . '</p>';
return '<p>' . $stripped_content . '</p>';
}

function echo_post_translated_by_od_team($postID, $current_lang = "en", $taxonomy ="language") {
Expand Down
6 changes: 1 addition & 5 deletions less/_search.less
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,14 @@
padding: 0px !important;
}

.ui-widget-content {
border: 0px !important;
}

.ui-state-default {
background: #f0f0f0 !important;
border: 0px !important;
color: @light-gray;
}

.ui-state-hover, .ui-state-focus {
background: #c8c8c8 !important;
background: @light-gray !important;
border: 0px !important;
color: @gray;
}
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 9f1f318

Please sign in to comment.