Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using [catlist categorypage=yes post_type=page] in the sidebar to display a list of pages with the same category as the current page. Wonderful, but it returns a link to the current page.

Is there a simple way to exclude the current page from the results?

share|improve this question
1  
You're using a shortcode. Where does it come from? –  kaiser Mar 8 '12 at 14:08

1 Answer 1

I believe so.

I think this is the plugin you're using: https://github.com/picandocodigo/List-Category-Posts

The doc says you can use excludeposts, so you'd use:

[catlist categorypage=yes post_type=page excludeposts=<ID_OF_PAGE>]
share|improve this answer
    
Yes, @Kelley van Evert is right, it is List-Category-Posts. –  caroig Mar 9 '12 at 8:04
    
Yes, @Kelley van Evert is right, it is List-Category-Posts. The shortcode is in a widget on all pages, so excludeposts would be fine if it would retrieve the current page id, but I don't think it will accept a variable. –  caroig Mar 9 '12 at 8:12
    
I see. I forked and pull-requested a little fix for that @ github, but that probably won't change your situation quickly. A second solution would be to use javascript. The displayed post ID is always present as a javascript variable, and you could also get the title; Now if you could identify the link via CSS, using the title and/or ID, then you could remove it with javascript. Could you give us an example of generated markup? –  Kelley van Evert Mar 10 '12 at 10:08
    
Hey kelly, I was looking at the code yesterday and had thought of extending excludeposts, to take a value of 'this' in addition to the IDs as current "[catlist excludeposts=this,52,37]" - either way, I'll probably patch my version of the plugin until the owner gets an update. It feels like a fairly basic requirement. –  caroig Mar 10 '12 at 14:58
    
Just a heads up to let you know I fixed this on the plugin. It's currently working on the Github version so a new release with this and other changes will be available soon: 0.24 –  Fernando Briano Apr 19 '12 at 7:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.