Do you want to hide a post from a list of posts in a category, or hide a specific category from the category list?
The problem with what you want to do is that it will probably have to be this way on EVERY page you view on your site. There are ways to change things for a specific category, but I’m not clear on what you want to do.
Here are some places to get more help:
The Loop in Action
Conditional Tags
Template Tags
http://codex.wordpress.org/Linking_Posts%2C_Pages%2C_and_Categories
Thread Starter
toto
(@toto)
Hi Lorelle
In my site im using WP 1.5.1 version.
I dont want to hide a post from a list of posts.
I dont want to hide specific category.
I want to hide specific post from a category.
For example: on my category page “Pepe” i have 11 excerpts to post with is showed and visible on page.
1. excerpt 1 (content)
2…
3…
4..
5..6..7…8..9..10
and 11
I want to hide some posts from this page for example pos 6 and 11.
Just they will not be visible for everyone but actually they are categorized in category “Pepe”.
And most important is to be accessed with simple link.
Is there anything that makes those posts you want to exclude different from the others?
If not, maybe you could create a custom field and do some tricks with that? (don’t worry if you don’t know how, we’ll help, it’s just an idea)
Oh, and assuming after only 3 hours that e.g. Lorelle won’t reply at all, you gotta look at the time below other people’s posts. We’re all living in different parts of the globe. Just so you know, I can’t reply right away either, I’m going to see Star Wars III 🙂
I’m not a WordPress master, but…
What you want to do can’ t be done using a standard page using the Loop. You would have to add php code to check for the specific posts (by id) you want to suppress, and then have the Loop skip those posts.
Thread Starter
toto
(@toto)
Very good Crowspeaker but what php code should I put?
All right, here’s a nasty hack.
First, create a Custom field in your admin page. call it ‘hide’, without the quotes.
Next, go to every post you want to hide. Select the custom field ‘hide’ for the post. For the value, type in ‘hide’, without the quotes. Click the update button.
Next, look at the beginning of your index.php page and you will see something like this (this is mine, anyway):
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post();?>
Make it look like this:
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post();
$hide= get_post_meta($post->ID, 'hide', 'true');
if ($hide=='hide' ) { } else {
?>
Also, near the end make sure you have the closing }
before the end of the post loop. Mine looks like this:
<?php }
endwhile; else: ?>
The downside to this hack is that you will NEVER see the post on any page where this logic occurs. If you set up a custom category page, you can take out the additional code.
To make your posts show up (say if you change you mind about hiding a particular post), just delete ‘hide’ from the value field on that post.