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 Mark Forums Read
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 01-08-2010, 05:34 PM   #1
Dennis69
Confirmed User
 
Join Date: Feb 2003
Location: Dreamland
Posts: 1,685
Wordpress Gurus... Help Me Please... Exclude Category Posts!

I'm trying to exclude a category from displaying it's post on the pages of my blog... I can get it work but when I do you can't navagate to other older posts

Here is the code I'm taking from wordpress help...

Code:
<?php
   if (is_home()) {
      query_posts("cat=-3");
   }
?>
And I'm adding it before the loop

Code:
				<div id="content">
                                                   (INSERTING ABOVE CODE ON THIS LINE)	
					<?php if (have_posts()) : ?>	
						<?php while (have_posts()) : the_post(); ?>
What am I doing wrong

Thanks in advance for the help
__________________
HaHaHa
Dennis69 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-08-2010, 05:48 PM   #2
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
you have to handle pagination

Code:
<?php if (is_home()) {
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
query_posts(“cat=-3&paged=$paged”);
} ?>
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-08-2010, 10:15 PM   #3
Dennis69
Confirmed User
 
Join Date: Feb 2003
Location: Dreamland
Posts: 1,685
Thanks fris... you rock
__________________
HaHaHa
Dennis69 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-08-2010, 10:44 PM   #4
Spankys Teens
Confirmed User
 
Spankys Teens's Avatar
 
Join Date: May 2005
Location: The Porn Land
Posts: 1,414
there's also a plugin that does it all.
Look for "Simply Exclude"
__________________
Banners - Design - TGP & more
Trade: Teenies In Action
icq: 256664696
Spankys Teens is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-08-2010, 10:49 PM   #5
Dennis69
Confirmed User
 
Join Date: Feb 2003
Location: Dreamland
Posts: 1,685
Just tryed that code Fris and I get
Parse error: syntax error, unexpected '='
Any idea what the problem could be?
__________________
HaHaHa
Dennis69 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-09-2010, 01:04 AM   #6
harvey
Confirmed User
 
harvey's Avatar
 
Industry Role:
Join Date: Jul 2001
Location: 127.0.0.1
Posts: 9,266
Quote:
Originally Posted by Dennis69 View Post
Just tryed that code Fris and I get
Parse error: syntax error, unexpected '='
Any idea what the problem could be?
are you closing the call properly? The code fris posted is correct and should work, it's the common solution used for your problem as developed by Kafkaesqui, one of WP main developers.

Anyway, alternatively you may try this with the is_home approach to see if it works (change is_archive to true if needed):

Code:
<?php
$limit = 10;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('cat=-3&paged=$paged' . '&posts_per_page=10' .'showposts=' . $limit . '&paged=' . $paged);
$wp_query->is_archive = false; $wp_query->is_home = true;
?>
__________________
This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth
harvey is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-09-2010, 01:06 AM   #7
harvey
Confirmed User
 
harvey's Avatar
 
Industry Role:
Join Date: Jul 2001
Location: 127.0.0.1
Posts: 9,266
aaah, now that I take a closer look to the code fris posted I see the problem. Instead of copy/pasting the code as fris posted, do it like this:

Code:
<?php if (is_home()) {
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=-3&paged=$paged");
} ?>
just a formatting problem
__________________
This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth
harvey is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-09-2010, 05:55 AM   #8
Spankys Teens
Confirmed User
 
Spankys Teens's Avatar
 
Join Date: May 2005
Location: The Porn Land
Posts: 1,414
jeeez, did u just miss that there's a ready made plugin - talk about stubborn
__________________
Banners - Design - TGP & more
Trade: Teenies In Action
icq: 256664696
Spankys Teens is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-09-2010, 06:23 AM   #9
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
Quote:
Originally Posted by Spankys Teens View Post
jeeez, did u just miss that there's a ready made plugin - talk about stubborn
some people like to get away without using as many plugins as possible, but advanced category excluder is a good one.
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-09-2010, 08:26 AM   #10
Dennis69
Confirmed User
 
Join Date: Feb 2003
Location: Dreamland
Posts: 1,685
Quote:
Originally Posted by harvey View Post
aaah, now that I take a closer look to the code fris posted I see the problem. Instead of copy/pasting the code as fris posted, do it like this:

Code:
<?php if (is_home()) {
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=-3&paged=$paged");
} ?>
just a formatting problem
Thanks Harvey and Fris... everything is working fine now
__________________
HaHaHa
Dennis69 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-09-2010, 08:28 AM   #11
Dennis69
Confirmed User
 
Join Date: Feb 2003
Location: Dreamland
Posts: 1,685
Quote:
Originally Posted by Spankys Teens View Post
jeeez, did u just miss that there's a ready made plugin - talk about stubborn

I didn't miss it but I'd rather use plugins for the big stuff rather then bloat my blog with a bunch of plugins... especially when it only a few words of code and some help to get it working right!
__________________
HaHaHa
Dennis69 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-09-2010, 11:22 PM   #12
Spankys Teens
Confirmed User
 
Spankys Teens's Avatar
 
Join Date: May 2005
Location: The Porn Land
Posts: 1,414
sowwy - my bad
__________________
Banners - Design - TGP & more
Trade: Teenies In Action
icq: 256664696
Spankys Teens 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
Thread Tools



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.