Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 07-15-2008, 10:55 AM   #1
EN1GMA
Confirmed User
 
EN1GMA's Avatar
 
Industry Role:
Join Date: Nov 2005
Posts: 1,251
[Wordpress Help] exclude a category from get_the_category

Hi friends,

Can someone please help me?
Basically, I'm using a specific/secret category to show all my posts EXCEPT one category, and I'm using this category on my index page. (Think CMS: almost all my posts are in the "artwork" category, as well as several others. Then I have a "press" category for the other posts..) I don't want "artwork" listed when I call get_the_category from within a post; I just want its other cats listed.

I found the solution for that with this code:

Code:
<?php foreach((get_the_category()) as $cat) {
if (!($cat->cat_name=='artwork')) echo $cat->cat_name . ' ';
} ?>
But now I have another problem...
Is it possible to exclude multiple categories instead of just one?
I´ve tried this code, but didnt help me:

Code:
<?php
  foreach((get_the_category()) as $cat) {
    if (
      $cat->cat_name!=='one' ||
      $cat->cat_name!=='two' ||
      $cat->cat_name!=='three' ||
      $cat->cat_name!=='four'
    ) echo $cat->cat_name . ' ';
  }
?>
Can someone help me in here, please? I really appreciate...
Many thanks!

P.S. If you can do it this with the_category function, will be better, because I need that categories with href (link)
EN1GMA is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-15-2008, 11:22 AM   #2
Linguist
Confirmed User
 
Join Date: Apr 2004
Location: Toronto, ON
Posts: 1,706
try != instead of !== i forgot the difference between the two (check php docs) but that may do the trick
__________________
315-310
Linguist is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-15-2008, 12:17 PM   #3
EN1GMA
Confirmed User
 
EN1GMA's Avatar
 
Industry Role:
Join Date: Nov 2005
Posts: 1,251
Thank you so much Linguist
EN1GMA is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.