Skip to content

Commit

Permalink
Merge branch 'master' into lcp-wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
klemens-st authored Oct 6, 2018
2 parents da16343 + fd06916 commit 1a83872
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 289 deletions.
4 changes: 2 additions & 2 deletions include/lcp-catlistdisplayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ private function build_output($tag){

$this->lcp_output .= $this->get_category_description();

$this->lcp_output .= $this->get_conditional_title();

$this->lcp_output .= '<' . $tag;

// Follow the numner of posts in an ordered list with pagination
Expand All @@ -130,8 +132,6 @@ private function build_output($tag){
$this->lcp_output .= '>';
$inner_tag = ( ($tag == 'ul') || ($tag == 'ol') ) ? 'li' : 'p';

$this->lcp_output .= $this->get_conditional_title();

//Posts loop
global $post;
while ( have_posts() ) : the_post();
Expand Down
20 changes: 14 additions & 6 deletions include/lcp-parameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,22 @@ public function get_query_params($params){
}

if ( $this->utils->lcp_not_empty('exclude_tags') ){
$args = $this->lcp_excluded_tags($params);
$args = $this->lcp_excluded_tags($args);
}

// Current tags
if ( $this->utils->lcp_not_empty('currenttags') && $params['currenttags'] == "yes" ){
$currenttags = $params['currenttags'];
if ( $currenttags === 'yes' || $currenttags === 'all' ) {
$tags = $this->lcp_get_current_tags();
if ( !empty($tags) ){
$args['tag__in'] = $tags;

if ( !empty($tags) ) {
// OR relationship
if ( 'yes' === $currenttags ) {
$args['tag__in'] = $tags;
} else {
// AND relationship
$args['tag__and'] = $tags;
}
}
}

Expand Down Expand Up @@ -279,7 +287,7 @@ private function lcp_types_and_statuses($args){
}

private function lcp_excluded_tags($args){
$excluded_tags = explode(",", $args['exclude_tags']);
$excluded_tags = explode(",", $this->params['exclude_tags']);
$tag_ids = array();
foreach ( $excluded_tags as $excluded){
$tag_ids[] = get_term_by('slug', $excluded, 'post_tag')->term_id;
Expand All @@ -306,7 +314,7 @@ public function starting_with($where){
global $wpdb;
$wp_posts_prefix = $wpdb->prefix . 'posts';
$charset = $wpdb->get_col_charset($wp_posts_prefix, 'post_title');

$where .= 'AND (' . $wp_posts_prefix . '.post_title ' .
'COLLATE ' . strtoupper($charset) . '_GENERAL_CI LIKE \'' . $letters[0] . "%'";
for ($i=1; $i <sizeof($letters); $i++) {
Expand Down
3 changes: 2 additions & 1 deletion include/lcp-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static function lcp_orders(){
"modified" => __("Modified Date", "list-category-posts"),
"title" => __("Post title", "list-category-posts"),
"author" => __("Author", "list-category-posts"),
"ID" => __("ID", "list-category-posts"),
"rand" => __("Random", "list-category-posts"));
}

Expand All @@ -36,4 +37,4 @@ public static function lcp_show_pagination($pagination){
($pagination !== 'no')
);
}
}
}
2 changes: 1 addition & 1 deletion list-category-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: List category posts
Plugin URI: https://github.com/picandocodigo/List-Category-Posts
Description: List Category Posts allows you to list posts by category in a post/page using the [catlist] shortcode. This shortcode accepts a category name or id, the order in which you want the posts to display, the number of posts to display and many more parameters. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
Version: 0.78
Version: 0.78.1
Author: Fernando Briano
Author URI: http://fernandobriano.com
Expand Down
Loading

0 comments on commit 1a83872

Please sign in to comment.