Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Exclude currently displayed post #8

Merged
merged 1 commit into from

2 participants

@caroig

This is the solution I've implemented for - http://goo.gl/50fJi , same problem as kelley's pull request (thks for his help).
Rough and ready.

@picandocodigo picandocodigo merged commit 9a397cd into picandocodigo:master
@picandocodigo picandocodigo referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 17, 2012
  1. @caroig
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 5 deletions.
  1. +12 −4 include/CatList.php
  2. +1 −1  readme.txt
View
16 include/CatList.php
@@ -35,7 +35,12 @@ private function set_lcp_parameters(){
));
//Exclude
- if(isset($this->params['excludeposts']) && $this->params['excludeposts'] != '0'): $args['exclude'] = $this->params['excludeposts']; endif;
+ if(isset($this->params['excludeposts']) && $this->params['excludeposts'] != '0'):
+ $args['exclude'] = $this->params['excludeposts'];
+ if (strpos($args['exclude'],'this')!==false) {
+ $args['exclude']=$args['exclude']. ",".$this->lcp_get_current_post_id();
+ }
+ endif;
// Post type and post parent:
if(isset($this->params['post_type']) && $this->params['post_type'] != '0'): $args['post_type'] = $this->params['post_type']; endif;
@@ -92,7 +97,11 @@ public function lcp_get_current_category(){
$categories = get_the_category($post->ID);
return $categories[0]->cat_ID;
}
-
+
+ private function lcp_get_current_post_id(){
+ global $post;
+ return $post->ID;
+ }
/**
* Get the category id from its name
* by Eric Celeste / http://eric.clst.org
@@ -123,8 +132,7 @@ public function get_category_link(){
if($this->params['catlink'] == 'yes' && $this->lcp_category_id != 0){
$cat_link = get_category_link($this->lcp_category_id);
$cat_title = get_cat_name($this->lcp_category_id);
- return '<a href="' . $cat_link . '" title="' . $cat_title . '">' .
- ($this->params['catlink_string'] !== '' ? $this->params['catlink_string'] : $cat_title) . '</a>';
+ return '<a href="' . $cat_link . '" title="' . $cat_title . '">' . $cat_title . '</a>';
} else {
return null;
}
View
2  readme.txt
@@ -94,7 +94,7 @@ You can use the *categorypage* parameter to make it detect the category id of th
* **excerpt_size** - Set the number of characters to display from the excerpt. Default is 255. Eg: `excerpt_size = 300`
-* **excludeposts** - IDs of posts to exclude from the list. Ex: [catlist excludeposts=12,52,37]
+* **excludeposts** - IDs of posts to exclude from the list. Use 'this' to exclude the current post. Ex: [catlist excludeposts=this,12,52,37]
* **offset** - You can displace or pass over one or more initial posts which would normally be collected by your query through the use of the offset parameter.
Something went wrong with that request. Please try again.