dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
uniqs
958
share rss forum feed


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

Wordpress - filter out authors from main feed

I've got a site where I want to be able to pull posts from an author ID to populate a section of that one page, but I don't want those posts going into the main blog feed. I can't find anywhere how or where to do this. My wordpress support posts sit languishing. Help me, Obi-Webmasters and Developers. You're my only hope!

Examples: I don't want the post at the bottom here: »manarin.com/dana-test-microsite/

to show up here: »manarin.com/our-blog/

The only way I've found so far is th back date it, but then it shows that back-dated timeframe on the microsite.
--
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


sbconslt

join:2009-07-28
Los Angeles, CA
You have IRC? Try asking in irc.freenode.net #wordpress


ProtusMose
Immortal. Eternal.
Premium
join:2001-10-03
Bellevue, NE
kudos:4
Got some info there I'll play with at work. Thanks for the tip!


sbconslt

join:2009-07-28
Los Angeles, CA
NP. The irc channels are very active, 24 hours.


stray

join:2000-01-16
Warren, NJ
reply to ProtusMose
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
Reviews:
·ooma
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. :\