i have looked everywhere and cant find it. Someone help me please
i have looked everywhere and cant find it. Someone help me please
You mean when it displays the posts on your blog?
Or when you are writing post you don't want to see the category choices?
Here's the text from your other thread, which I deleted:
here it goes.
all of my posts have to be in a category called featured. I found a way to get rid of it showing on the header but now i need to find out how to get rid of it when people view posts. I don't need to cancel out all categories from the posts. Just a selection.
If you want to delete categories from displaying with your post...
If you are using the WordPress Default theme, you would delete:
Posted in <?php the_category(', ') ?>
from the wp-content/themes/default/index.php file.
See also:
Stepping Into Template Tags
Stepping Into Templates
Template Hierarchy
the_category()
ok i don't want to delete all of the catergories from the post. I mean by when you view a post it shows the catergories i just want to exclude some catergories from showing in the list. Yes i mean from when i display posts.
Might look at Category Access allows you to limit, by user, what categories the person sees when edit posts.
http://www.coppit.org/code/
ok let me break it down...
I don't want to hid the posts or catergories
I want to hide a CERTAIN CATEGORY listing that shows below all of the text in my post. I just don't want it to list certain catergories. If you want ill get you a picture of what i mean.
Okay I missed you saying "when I display posts".
Anyway, look at the template tag, get_the_category().
Resources:
Stepping Into Template Tags
Stepping Into Templates
Template Hierarchy
well after going through all of the stuff and tried pratically everything i got nothing.
So take all the code from your template, including what you did try, and post it in a pastebin and report the link back here.
A link to see your site would be helpful also.
pastebin http://pastebin.com/m533cb97d
site: http://www.insanegaming.co.cc
edit: the ones i tried i had deleted but i tried all from the_category
Since you didn't show what you tried not too sure what didn't work for you but you would replace <?php the_category(', '); ?> with something like
<?php
foreach((get_the_category()) as $category) {
if ($category->cat_name != 'cat_to_exclude') {
echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> ';
}
}
?>got it working after trial and error thanks a bunch :D
Hello,
Where i put the ID to hide a category ? , thx a lot!!
up
up!!
UPPP
Check the docs or create a properly contexted question that explains what you want to do...
Bumping a post with Up!! UPP!! etc is not going to earn you any special help.
I have already check the codex but , I don't understand where i can put the ID category I want to hide in the code of MichaelH !
If you can help me thx a lot :x
i replace the code <?php the_category(', '); ?> , and i don't know where I place the "exclude=204" (204 it s the number of my category )
Replace...
cat_to_exclude
with the name of the category...
Using Michael's example...
You use the category name and not the ID... it's quite self explanatory if you look at the code...
<?php
// For each of the categories, create them as category variables
foreach((get_the_category()) as $category) {
// If the category is NOT the cat_name (category name) then echo some stuff
// So grab all... except where they match cat_name (exclude basically)
if ($category->cat_name != 'cat_to_exclude') {
echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> ';
}
}
?>
I added a few comments in there (the code will still work), but it should be obvious.
oh ok, thx a lot :)
it works !
Hello,
This was really helpful.
How do I go about hiding more than 1 category using this method?
Yeah you should be able to do something like this... (untested)
Change this line...
if ($category->cat_name != 'cat_to_exclude') {
To...
if ($category->cat_name != 'cat_to_exclude' or 'another_cat_to_exclude') {
Let me know if that works for you...
I tried this but it didn't work
if ($category->cat_name != 'Past Project' or 'Current Project') {
Try this instead then..
if ($category->cat_name != 'cat_to_exclude' || $category->cat_name != 'another_to_exclude') {
Hmm.. Can't get that last one working either..
if ($category->cat_name != 'uncategorized' || $category->cat_name != 'featured') {
This hides "uncategorized" just fine, but "featured" still shows up.
Did anyone figure out how to hide more than one category?
Any help would be appreciated. Thanks.
Or you could use a plug-in .. Advanced Category Excluder
This topic has been closed to new replies.