[wp-hackers] Exclude Categories From The Loop

Peter Westwood peter.westwood at ftwr.co.uk
Fri Oct 5 14:10:34 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kevin wrote:
> Unless something has changed shouldn't the code referenced in the
> codex loop page work?
> http://codex.wordpress.org/The_Loop
> 
> Specificly:
> <?php if (in_category('3')) continue; ?>
> 
> Obviously this isn't optimized from a SQL perspective (you're still
> pull all posts from the DB, just not displaying some of them), but it
> does what was asked for.
> 

The biggest issue with this AFAIK is that it means that you may end up
with less posts on the page than expected.

And if the last "n" posts are all in the category you get no posts

westi
- --
Peter Westwood
http://blog.ftwr.co.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHBkXZVPRdzag0AcURAg9dAJ0d1TZrYztzCZAxRxX7RYEh3E+P4gCfXt5v
ky0GD1Wpn553XwL1UpYcLXs=
=pYOv
-----END PGP SIGNATURE-----


More information about the wp-hackers mailing list