Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

wordpress category exclusion from blog page


  • Please log in to reply

#1
Dreylivude

Dreylivude

    Member

  • Member
  • PipPipPip
  • 109 posts
Hello everyone. I've been trying to figure out how to get a certain category in my blog to not show up in the main blog page. I've been having some trouble with this. I've tried two bits of code:

[codebox]<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<?php static $count = 0;
if ($count == "n") { break; }
else { ?>

<?php if ( in_category('x') && !is_single() ) continue; ?>
<?php if ( in_category('y') && !is_single() ) continue; ?>
<?php if ( in_category('z') && !is_single() ) continue; ?>

<div class="post">
<?php the_content(); ?>
</div>

<?php $count++; } ?>
<?php endwhile; ?>
<?php endif; ?>[/codebox]

This was a whole new loop that I decided to use to clean things up, but the category exclusion code in there somehow only makes my blog show one post, the latest one.

Then I tried:

[codebox]if (is_home()) if (in_category(’14′)) continue;[/codebox]

But that just broke my blog. It said not found. I believe that doesn't work because my blog page isn't the home page in my wordpress site. That is the same reason why I think the plugins for this sort of thing didn't work. I tried two.

Any suggestions would be great. Thank you.

Edited by Dreylivude, 01 March 2009 - 07:17 PM.

  • 0

Advertisements


#2
Metallica

Metallica

    Spyware Veteran

  • GeekU Moderator
  • 33,101 posts
Hi Dreylivude,

Can you post a link to your blog?
Some of the code depends on the theme you are using.
  • 0

#3
Dreylivude

Dreylivude

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 109 posts
It's actually my own custom theme. I don't really know much about php so I just kinda hobbled it together, probably not in the best way. It works for the most part, but I'm very lost when I want to change something.

My site is m-cub3d.com
  • 0

#4
Metallica

Metallica

    Spyware Veteran

  • GeekU Moderator
  • 33,101 posts
The site sure looks good. :)

As far as I can tell your php code contains some syntax errors, but none show up at your site.

Can you let us know what you want the piece of code to do exactly?
  • 0

#5
Dreylivude

Dreylivude

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 109 posts
Well I mentioned that in my first post. See my site is a portfolio site for my work to show employers. I'm in school right now and have been using it for group work to show my teachers, so because of that there are posts in the blog section that are not by me. I want to be able to exclude a certain category from the blog section so perspective employers won't assume I did something that wasn't actually mine. So I just don't want a certain category to show up on the main blog page.
  • 0

#6
Metallica

Metallica

    Spyware Veteran

  • GeekU Moderator
  • 33,101 posts
Yeah, but I don't see any categories listed anywhere, so I can't tell what you want to change.

See if you can get it done with these instructions:
http://faq.wordpress.net/view.php?p=56
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP