Exclude Category from Blog Page (Wordpress)

efeezy

New member
Oct 5, 2007
5,250
136
0
50
For some reason I can't change the loop to get this working properly.

I have a page on my Wordpress site named "Blog" and all the latest posts show there. I have a particular post category that I want excluded from showing on "Blogs". I can't find the right call to exclude categories on that page. I've tried using this on the page.php. The cat id I want to exclude is #4.

Code:
<!--Content-->
                <div id="content">
               [COLOR=Orange][B] <?php query_posts($query_string . '&cat=-4'); ?[/B][/COLOR]>
                        <div id="content_title">
                        <?php if (get_post_meta($post->ID, 'short_text', true)): ?>
                                <?php echo get_post_meta($post->ID, 'short_text', true); ?>
                        
                        <?php else: ?>
                        <?php the_title(); ?>
                        
                        <?php endif; ?>        
                        </div>
                        
                        
                        
                        
                        <?php if (($post->post_parent) or (get_post_meta($post->ID, "sidebar", true)) or (is_page($scr_contactpage_id))): ?>
There has to be a simple fix for this. Anyone have ideas I can try? Thanks.
 


For some reason I can't change the loop to get this working properly.

I have a page on my Wordpress site named "Blog" and all the latest posts show there. I have a particular post category that I want excluded from showing on "Blogs". I can't find the right call to exclude categories on that page. I've tried using this on the page.php. The cat id I want to exclude is #4.

Code:
<!--Content-->
                <div id="content">
               [COLOR=Orange][B] <?php query_posts($query_string . '&cat=-4'); ?[/B][/COLOR]>
                        <div id="content_title">
                        <?php if (get_post_meta($post->ID, 'short_text', true)): ?>
                                <?php echo get_post_meta($post->ID, 'short_text', true); ?>
                        
                        <?php else: ?>
                        <?php the_title(); ?>
                        
                        <?php endif; ?>        
                        </div>
                        
                        
                        
                        
                        <?php if (($post->post_parent) or (get_post_meta($post->ID, "sidebar", true)) or (is_page($scr_contactpage_id))): ?>
There has to be a simple fix for this. Anyone have ideas I can try? Thanks.


any reason why you're using the $query_string? from the looks of this page, it's not needed:

Function Reference/query posts WordPress Codex
 
Uh..only using it after reading another page on the WP codex site. Suggestion for a better way to do that?