Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

What is the code in order to put some posts in different pages? I already have one but the tittle of post is missing. And i don't know how to.

This is the code that i have now:

<?php get_header(); ?>

<div id="innerTop">
        <div class="innerTitle clearfix"><h1><?php the_title(); ?></h1></div>
        <?php $pagedesc = get_post_meta($post->ID, 'page_description', $single = true);?>
        <?php if($pagedesc !=''){?>
        <div class="innerDesc"><?php echo $pagedesc ?></div>
        <?php }?>
</div>

<!-- begin colLeft -->
    <div id="colLeft">
<?php
$catID = 0;
if (is_page('apple')) {
  $catID=12;
} elseif (is_page('htc')) {
  $catID=13;
} elseif (is_page('nokia')) {
  $catID=14;
}

if ($catID) {
   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
   query_posts("cat=$catID&amp;paged=$paged");
} ?>
<?php
$title = $queried_post->post_title;
echo $title;
?>



        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

        <?php the_content(__('(more...)')); ?>

        <?php endwhile; else: ?>
        <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
        <?php endif; ?>
    </div>
    <!-- end colleft -->

    <?php get_sidebar(); ?>  

<?php get_footer(); ?>

I would love for an answer please.

share|improve this question

1 Answer 1

get_posts may be easier for you to use:

        $args = array( 'numberposts' => 5, 'category' => '3' );
        $myposts = get_posts( $args );
        foreach( $myposts as $post ) :  setup_postdata($post); ?>
            <div <?php post_class(); ?> id="post-<?php the_ID(); ?>" style="padding-bottom:5px;">
                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                <div class="post_meta"><?php twentyten_posted_on(); ?></div>
                    <div class="entryContent">
                        <?php the_content(); ?>             

                    </div>
            </div>
        <?php endforeach; ?>
share|improve this answer
    
I'm really new at this. There is anything i have to change on your code? Sorry –  catarina moura Jul 13 '11 at 21:28
    
To not restrict by category, remove the ",'category' => '3'' –  GavinR Jul 14 '11 at 1:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.