PHP Code:
<?php get_header() ?> <div id="center"> <?php get_sidebar() ?> <div id="ads"> here are some adsthis is the ad space yo </div>
<div id="content">
<?php $posts = get_posts( "category=1&numberposts=6" ); ?> <?php if( $posts ) : ?> <div id="chat" class="post"> <h2><?php the_category(', '); ?> »</h2> <?php foreach( $posts as $num => $post ): setup_postdata($post); if ( $num == 0 ) {// this is the first post ?> <div class="pleft"> <h3 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h3> <div class="entry-content"> <?php the_content('[Read the rest of this entry]'); ?> </div> </div> <div class="pright"> <p>Previous Posts in <?php the_category(', '); ?></p> <ul> <?php } // these are the rest ?> <li><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></li> <?php endforeach; ?> </ul> </div> <hr /> </div> <?php endif; ?>
<?php $posts = get_posts( "category=4&numberposts=6" ); ?> <?php if( $posts ) : ?> <div id="chat" class="post"> <h2><?php the_category(', '); ?> »</h2> <?php foreach( $posts as $num => $post ): setup_postdata($post); if ( $num == 0 ) {// this is the first post ?> <div class="pleft"> <h3 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h3> <div class="entry-content"> <?php the_content('[Read the rest of this entry]'); ?> </div> </div> <div class="pright"> <p>Previous Posts in <?php the_category(', '); ?></p> <ul> <?php } // these are the rest ?> <li><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></li> <?php endforeach; ?> </ul> </div> <hr /> </div> <?php endif; ?> <?php $posts = get_posts( "category=3&numberposts=6" ); ?> <?php if( $posts ) : ?> <div id="chat" class="post"> <h2><?php the_category(', '); ?> »</h2> <?php foreach( $posts as $num => $post ): setup_postdata($post); if ( $num == 0 ) {// this is the first post ?> <div class="pleft"> <h3 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h3> <div class="entry-content"> <?php the_content('[Read the rest of this entry]'); ?> </div> </div> <div class="pright"> <p>Previous Posts in <?php the_category(', '); ?></p> <ul> <?php } // these are the rest ?> <li><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></li> <?php endforeach; ?> </ul> </div> <hr /> </div> <?php endif; ?>
</div> </div> <?php get_footer() ?>
hi i made this for wordpress however im getting some problems
each post i make has one category
however when i run this script, it shows
<h2>cat 1</h2> with posts listed under cat 1
<h2>cat 1</h2> with posts listed under cat 2
<h2>cat 2</h2> with posts listed under cat 3
even if you dont use wordpress, can u check the script?
|