Skip to content

Commit

Permalink
Merge pull request #288 from zymeth25/lcp-wrapper
Browse files Browse the repository at this point in the history
Refactor CatListDisplayer, add some tests
  • Loading branch information
picandocodigo authored Jun 17, 2020
2 parents a59b084 + db95501 commit 7bc858a
Show file tree
Hide file tree
Showing 7 changed files with 276 additions and 203 deletions.
20 changes: 18 additions & 2 deletions include/lcp-catlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,17 @@ public function get_morelink(){
endif;
}


public function get_posts_morelink($single, $css_class) {
if(!empty($this->params['posts_morelink'])){
$href = 'href="' . get_permalink($single->ID) . '"';
$class = $css_class ?: "";
if ( $class ):
$class = 'class="' . $class . '" ';
endif;
$readmore = $this->params['posts_morelink'];
return ' <a ' . $href . ' ' . $class . ' >' . $readmore . '</a>';
}
}

public function get_category_count(){
if($this->utils->lcp_not_empty('category_count') && $this->params['category_count'] == 'yes'):
Expand Down Expand Up @@ -269,6 +279,12 @@ public function get_custom_fields($custom_key, $post_id){
endif;
endforeach;

// Return a string instead of array if custom fields
// are not displayed separately.
if ($this->params['customfield_display_separately'] === 'no') {
$lcp_customs = implode($this->params['customfield_display_glue'], $lcp_customs);
}

return $lcp_customs;
else:
return null;
Expand Down Expand Up @@ -330,7 +346,7 @@ public function get_date_to_show($single){

public function get_modified_date_to_show($single){
if ($this->params['date_modified'] == 'yes'):
return get_the_modified_time($this->params['dateformat'], $single);
return " " . get_the_modified_time($this->params['dateformat'], $single);
else:
return null;
endif;
Expand Down
Loading

0 comments on commit 7bc858a

Please sign in to comment.