• I am successfully running WordPress 0.7.1.1 for a few weeks now and its fun working with it. I also have been able to take quite a fiew things from these support forums to improve my setup.
    I haven’t been able to _exclude_ one or more categories from the display.
    I have tried using <?php $excluded_categories=3;?> on top of the page after re required stuff there as well as I tried to put it where the content loop is (before it acually).
    Did I use the wrong function, or is it at the wrong place?
    Also, it would be great if I could say something like “last entry from every category”.
    thanks a lot if you have any ideas with this!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Mischa

    (@anunnaki)

    —> Could it be that the_content doesn’t look for the Category?
    I have found a nice piece of category code within blog.header.php which basically looks if the variable “cat” has dashes in and if so, it puts the stuff into an array.
    I have put this on top (Cat.3 is my blog which shall be excluded on frontpage)
    <?php /* Don’t remove this line, it calls the b2 function files ! */
    $blog=1;
    $cat=”1 2 4 5 6″;
    require_once(‘blog.header.php’);
    require($abspath.’wp-links/links.php’);
    ?>
    When I display $whichcat, I get:
    AND (post_category = 1 OR post_category = 2 OR post_category = 4 OR post_category = 5 OR post_category = 6)
    yet the posts with cat=3 still appear on the site…

    Hi Anunnaki,
    I tried this and it works for me, I’m not quite sure why it isn’t working for you, especially with the SQL being correct!
    A couple of tips though:
    You can say $cat=’-3′; which will work the same as your example above.
    But you may also want to say
    if (empty($cat))
    $cat=’-3′;
    Otherwise you will never be able to display category 3 in that template. I realise this may be ok for you especially if you have another template for that category.
    Mike

    Thread Starter Mischa

    (@anunnaki)

    Thanks much, MikeLittle!
    After reading it, I had to smile upon myself not having the idea of “-3” ??
    I really enjoy using WordPress and maybe some time I will even understand what it does inside *ggg*

    came across a very interesting website,it appears to be a groundbreaking trilogy film,I think it’s worth checking
    https://www.1anunnaki.com

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to exlcude Categories’ is closed to new replies.