site Search:


 
    All Forums Hot Topics Gallery






how-to block ads


 
Search Topic:
Share Topic
Posting?
Post a:
Post a:
Links: ·How To Get Noticed ·Web Monks FAQ ·Webhosting FAQ ·Posting Code ·How To Post ·Webhosting forum
AuthorAll Replies


stray

join:2000-01-16
Warren, NJ

reply to ProtusMose

Re: Wordpress - filter out authors from main feed

Click for full size
This is easily done in Wordpress's index.php just before the main loop:

Each theme has a slightly different index.php, but they all use "the loop". By adding the line:

<?php query_posts($query_string . '&author=-2'); ?>

just before the actual loop starts, you are making sure that the posts the loop sees does not include those from author number 2.

--
V-Rtifacts - When Virtual Reality Was More Than Virtual


ProtusMose
Immortal. Eternal.
Premium
join:2001-10-03
Bellevue, NE
kudos:4

Thanks! That works for the main blog landing page. I've got it set to
$my_query = new WP_Query( 'author=-20' );

I'm struggling now to figure out how to add that argument to the other sections that pull feeds. For example, the front page of the site pulls the last three posts and displays at the bottom of the page.

<h2><?php the_title(); ?></h2>
 
<!-- // bodycopy \\ -->
<div class="bodycopy">
<div class="columnone">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content(__('(more...)')); ?>
<?php endwhile; else: ?>
<?php endif; ?>
</div>
 

If I could get that section to filter out also, it would be enough for me to move forward in a project and figure out how to strip it from the archives at a later date.

--
Blogsaus "Everyone bows to something. Everyone answers to someone. Wherever your treasure lies, there your heart will be also.

Who do you belong to? " - Andrew Schwab


stray

join:2000-01-16
Warren, NJ

Same line added just before:

<?php query_posts($query_string . '&author=-20'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
 

will do the trick. The idea is to setup any special conditions on your posts database query before you head into the loop: while (have_posts) ....

--
V-Rtifacts - When Virtual Reality Was More Than Virtual


ProtusMose
Immortal. Eternal.
Premium
join:2001-10-03
Bellevue, NE
kudos:4

That's not working right now. I'll have to play with it more tonight outside of business hours. :\


Monday, 20-May 04:30:36 Terms of Use & Privacy | feedback | contact | Hosting by nac.net - DSL,Hosting & Co-lo
over 13.5 years online © 1999-2013 dslreports.com.
Most commented news this week
Hot Topics