Wordpress Code Help.. I Have No Idea What They Did $5 Paypal To Whoever Fixes This.

You can use a negative category value to exclude any given category_id from the loop, as follows

Code:
<?php if (!is_paged() and is_home()) {       query_posts('cat=-519');        wp_reset_query();

...which excludes posts from the category id 519 from showing
 
You can use a negative category value to exclude any given category_id from the loop, as follows

Code:
<?php if (!is_paged() and is_home()) {       query_posts('cat=-519');        wp_reset_query();

...which excludes posts from the category id 519 from showing

So where do I put this? And what about the $i=1 part?

I know u said u tried in functions.php but take a look at this snippet http://wp-snippets.com/exclude-category-from-homepage/

Yup, saw that and tried it as well, but it didn't work, broke my site and gave me an error so I had to reupload the backup functions.php. Add: Getting a parse error with that code..
 
Last edited:
So where do I put this? And what about the $i=1 part?

Well the $i=1 has nothing todo with any of the code you have posted, must be part of the theme or such... All you need to exclude cats is...

Code:
query_posts('cat=-519');

..replacing 519 with the correct ID, so easiest means would be to edit your themes index.php and look for the query_posts command and add
Code:
&cat=-519
to it if it already contains a string, otherwise use
Code:
cat=-519
 
Well the $i=1 has nothing todo with any of the code you have posted, must be part of the theme or such... All you need to exclude cats is...

Code:
query_posts('cat=-519');

..replacing 519 with the correct ID, so easiest means would be to edit your themes index.php and look for the query_posts command and add
Code:
&cat=-519
to it if it already contains a string, otherwise use
Code:
cat=-519

Thanks! So.. This is the only place on the index.php file where the word "query_posts" shows:

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('posts_per_page=10&paged='.$paged);
?>
<?php $i=1; if (have_posts()) : ?>

Now is this correct? All I have to do is replace that part so it looks like this:

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_postsquery_posts('cat=-519');
?>
<?php $i=1; if (have_posts()) : ?>

Does that look right? Orrr I think I'm close, not sure what to change exactly in that line of code or how to add it in. Thanks!
 
Problem fixed, someone on another forum manually did it for me, sorry and thanks everyone!
 
Back
Top