...

View Full Version : help with my script



raptrex
01-03-2008, 09:31 PM
<?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(', '); ?> &raquo;</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(', '); ?> &raquo;</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(', '); ?> &raquo;</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

however its suppose to be
<h2>cat 1</h2> with posts listed under cat 1
<h2>cat 2</h2> with posts listed under cat 2
<h2>cat 3</h2> with posts listed under cat 3
even if you dont use wordpress, can u check the script?

ziggy1621
01-04-2008, 03:45 AM
first of all, when you post here, you should really clean up your code to show only what needs to be seen for the issue.

Now you have a script here from just a quick browse that includes a lot. Like where is the function "get_posts" made (post that code). Is this something being pulled from a database? and your get_posts on here are for cat1 3 & 4



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum