[wp-hackers] Re: get_posts / query_posts need a pro

Mr. Awesome theone.andonly.mr.awesome at gmail.com
Tue Mar 11 05:52:08 GMT 2008


Hmm, I think I have something here... well, almost doing what I want it 
to do...

UPPER POST SECTION:

<div id="announcement-post">


<?php
 global $post;
 $myposts = get_posts('numberposts=1&category=3');
 foreach($myposts as $post) :
setup_postdata($post);
 ?>

<div class="post" id="post-<?php the_ID(); ?>">
<div class="date">
                <span class="monthyear"><?php the_time('F') ?></span>
                <div class="day"><?php the_time('j') ?></div>
                <span class="monthyear"><?php the_time('Y') ?></span>
                </div><h2 class="posttitle"><a href="<?php 
the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent link to'); 
?> <?php the_title(); ?>"><?php the_title(); ?></a></h2>
           
                <p class="postmeta"> <?php _e('Filed under'); ?> <?php 
the_category(', ') ?>
                <?php edit_post_link(__('Edit'), ' &#183; ', ''); ?>
                </p>
                <div class="postentry">
                <?php if (is_search()) { ?>
                    <?php the_excerpt() ?>
                <?php } else { ?>
                    <?php the_content(__('Read the rest of this entry 
&raquo;')); ?>
                <?php } ?>
                </div>
           
                <p class="postfeedback">
                <?php comments_popup_link(__('comments (0)'), 
__('comments (1)'), __('comments (%)'), 'commentslink', __('comments 
off')); ?>
                </p>               
                <!--
                <?php trackback_rdf(); ?>
                -->
</div> <?php endforeach; ?>


Doing THAT there, shows ONE post from that ONE category, including it's 
CONTENT using <?php
 global $post;
 $myposts = get_posts('numberposts=1&category=3');
 foreach($myposts as $post) :
setup_postdata($post);
 ?>.

The lower section is using the normal loop so far... So, whatever is 
posted in the top, will show in the lower section with normal posts 
though... but I don't think that's a big deal... it's basically 
archived.. and the "< previous entries" link works fine too.. I THINK I 
got something here... notice I said .. "I THINK" lmao... It looks like 
it's working just fine.. so.. =D


More information about the wp-hackers mailing list