How do I hide a category's posts from the news page?

Hello all,

Got a quick question here: How do I hide a category's posts on the news page?

I've got the MyArcade Pro plugin and I want to hide the arcade games from the news page. Thanks to the plugin, I can limit the games to just one category, so I just need to know how to hide a category from the News page. (News isn't on the main page because I have another page set as the home page.)

Thanks for the help in advance!

  • jim_meyer
    • Syntax Hero

    Sometimes, when you display certain posts on your WordPress powered site you may need to hide speciffic categories from posts pages. This is needed because categories are often used as system "markers" in sites structure.

    To do this, enter the following lines above the Loop (check out this tutorial for more information on What is The Loop) :
    http://www.siteground.com/tutorials/wordpress/the-loop.htm

    <?php if (is_front_page() && !is_paged() )
    $posts = query_posts($query_string . '&cat=-33,-66'); ?>

    This prevents posts from categories 33 and 66 from appearing in the list of posts.

  • jim_meyer
    • Syntax Hero

    This also may help:

    There is a fairly simple way. If you only want to remove Author, Date and Category from the posts that are displayed on the home page, then you will have to make some changes into the index.php in your theme folder.

    1) Open your theme folder (located in wp-content\themes\your theme name)
    2) Locate the index.php file. Create a backup and then edit the original file. In case something goes wrong, you can always restore the original file.
    3) Open the original index.php and locate the following functions

    get_the_author()

    the_time()

    the_category

    4) Comment out the function lines and the markup from where it is getting generated.

    E.G
    If it is something like this
    <h2><?php printf( esc_attr__( 'About %s', 'twentyten' ), get_the_author() ); ?></h2>
    then turn it into this
    <!--<h2><?php //printf( esc_attr__( 'About %s', 'twentyten' ), get_the_author() ); ?></h2>-->

    If you are not getting the idea, then please go through this
    http://codex.wordpress.org/The_Loop

  • Nathan Pinno
    • The Incredible Code Injector

    Would it work if I applied it to the main theme, and was using a child theme?

    I'm using BuddyPress with Frisco as the theme if that helps. The update to 'custom community' by it's author really borked it, and made it not work for me anymore. :slight_frown:

  • aecnu
    • WP Unicorn

    Greeting Nathan Pinno,

    Thank you for the additional questions.

    Would it work if I applied it to the main theme, and was using a child theme?

    I have no idea, think about it, to figure it out and give a straight up answer we would have to recreate the same scenario, same theme, same situation to test to see if it works in this manner.

    The update to 'custom community' by it's author really borked it, and made it not work for me anymore.

    In this case you should be all over the author ~or~ roll back to the previous version.

    Please advise.

    Cheers, Joe

  • Nathan Pinno
    • The Incredible Code Injector

    I switched to the versatile Frisco child theme of the BuddyPress Default for my sites that were using 'custom community'. I'm going to leave a review at WordPress.org as well stating as such.

    As far as I can tell, applying the code from the first solution to the main theme didn't work on the child theme - I thought they inherited the same code when they didn't have their own edited version.

    Maybe BuddyPress has it's own loop?

  • aecnu
    • WP Unicorn

    Greeting Nathan Pinno,

    I have reviewed this entire ticket tonight and it left me wondering if the Arcade pages are actually pages?

    Do they show in your pages listings by any chance? If so I have a plan that will resolve this I believe.

    Please advise.

    In any event, have a GREAT upcoming weekend!

    Cheers, Joe

  • aecnu
    • WP Unicorn

    Greeting Nathan Pinno,

    Sure you can certainly attach it if you want but I want you to know I am not a coder so we may not get the full bang out of it but it is certainly worth a shot and I may be able to get a lead developer /coder in here to check it out as well possibly giving us advice/advise us to what we may due to get this handled.

    In a recap: We are still trying to stop it from displaying in the news section correct? And the news section is displaying the games themselves which are custom posts?
    Is the news section from a theme or from a plugin?

    Please advise.

    Cheers, Joe

  • Nathan Pinno
    • The Incredible Code Injector

    The news section is a page that I've set as to where posts are to show up (under Settings -> Writing) as I have a different page as the home page. Usually (by default) news posts show up on the home page.

    Here is the file. I've zipped it up as I suspect that it would be safer this way. I also prefer using my blog's space when sharing files, if you're curious as to why I've uploaded the file there. :wink:

  • aecnu
    • WP Unicorn

    Greetings Nathan Pinno,

    Thank you for shipping over the tpl file and I hope to get a coders eyeballs on it soon to possibly tell us how to filter the categories as we (you and I) have been working on.

    This could take some time however and I am not a coder myself so I would be researching other avenues to accomplish this. With that said check these out and perhaps one of them may fit the need that we have to accomplish this mission:
    http://wordpress.org/extend/plugins/search.php?q=category+filtering&sort=

    Please advise if you find something that works there, they all had different options etc. is why I did not recommend any single solution leaving it to you to choose form what you see fit and like the most.

    Let me know how it goes and looking forward to hearing form you in any event.

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.