• I have no idea why this isn’t working. I’ve implemented this and currently have it working on other sites that I’m running, but for whatever reason, it isn’t working on the site I’m working on right now. Maybe there’s something I’m missing from looking at it for too long.

    I have the site setup to display a static front page & post page in the “Reading” section. I’ve got the posts styled fine, everything laid out the way I want it. Now I just want to exclude a certain category from displaying on the post page. I’ve got the category ID and everything, and here is the code:

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 9 replies - 1 through 9 (of 9 total)
  • can you post your query_string?

    Thread Starter coreymcollins

    (@coreymcollins)

    Welp, I DID have it posted, but I guess that’s not allowed. Here’s the link: http://pastebin.com/2bsJQAr6

    Thread Starter coreymcollins

    (@coreymcollins)

    The really weird thing is that this DOES work if I’m looking at a category page. So if I tell this thing to exclude all posts in, let’s say, the “Food” category – for whatever reason, all of the food posts STILL display on the home page, but they won’t be there on the category page. I just don’t understand why it works for one but not the other.

    What template file are you adding the code to?

    Thread Starter coreymcollins

    (@coreymcollins)

    I’m editing my index.php file, which I’ll admit seems odd to me.

    I’ve got the “Reading” portion of the Dashboard set to: Front Page–>My Homepage and Posts Page–> My Blog.

    I created the “My Blog” page and set it to no template, as is suggested in the WP Codex. So, the “My Blog” page now takes on the form of the “index.php” page instead of, say, the actual default page template (page.php).

    I’m just at a loss.

    The index.php template file in your theme would be the right file to edit. It’s the template that is used for your main posts page. A static front page uses front-page.php (if it exists), page.php or whatever custom page template that has been applied to it.

    This might sound rather obvious but have you checked that you’re editing the right index.php file? Have you remembered to add <?php global $query_string;?> immediately before your custom query?

    Thread Starter coreymcollins

    (@coreymcollins)

    I posted my code above (linked to pastebin), but I’ve come across something just now.

    If I use this rather than the first line I have now:
    <?php query_posts('cat=-12'); ?>

    It DOES work… sort of. It will remove posts in category 12 from the list, but then the older posts link stops working properly. If I click “Older”, it goes to a 2nd page of entries, but they’re the exact same entries as were on the first page.

    If you want to take a look at my code linked above and let me know where I may be falling short, that would be excellent. As I said, I’ve done this before with no issue, so I’m not really sure why I’m having so much trouble now.

    Thanks!

    Thread Starter coreymcollins

    (@coreymcollins)

    I don’t want to come off as ungrateful for your help, because I am very grateful, but I have looked at that page previously and still can not figure out what I’m doing wrong.

    For sake of ease, here’s a link to the code I can’t get to work:
    http://pastebin.com/2bsJQAr6

    And here’s a link to the code I have on another site which is working properly:
    http://pastebin.com/1PGKPZd9

    Other than styling differences, there is nothing I can see that is different about those two bits of code. They are asking for the same function, yet only one is running properly. I’m sure there’s something small I’m missing, but for the life of me, I can’t figure out where or what it is.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Excluding Categories on Homepage’ is closed to new replies.