• Hi to all,
    I’am new here and i have several questions:
    First i would like to ask how to display in the front page, i.e 3 posts from different categories in each row, that each post contains title, image, date,and a summary from the post. Actually i want to make something like that http://www.pkool.gr is a greek site but you can see the structure of the website.

    Thanks a lot.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I would use a call for 3 posts from that category by doing this:

    <ul>
    <?php $recent = new WP_Query(); ?>
    <?php $recent->query('cat=4&showposts=3'); ?>
    <?php while($recent->have_posts()) : $recent->the_post(); ?>
    <li>
    
    Then grab all the info you want in each column
    
    </li>
    <?php endwhile;?>
    </ul>

    Then I’d style the ul tag with a class and display the list inline.

    Thread Starter zihatzik

    (@zihatzik)

    Is that the best way to do it??
    That displays posts only from one category and what about the images?

    You’d grab the images where sarahfrantz listed “grab all the info you want in each column”.

    things like the_permalink(); wp_thumbnail(); the_title(); etc….

    Thread Starter zihatzik

    (@zihatzik)

    Hi and thanks a lot for your replies,

    I have few more questions:
    1) The file that i have to update is the template.php …right?
    So… until now i wrote that:

    i have commented out that:
    <?php //echo $this['template']->render('content'); ?>
    <ul>
    <?php $recent = new WP_Query(); ?>
    <?php $recent->query('showposts=3'); ?>
    <?php while($recent->have_posts()) : $recent->the_post(); ?>
    <li>
     <h2><a href="<?the_permalink(); ?>"><?the_title();?></a> </h2>
    <?
    the_content();
    ?>
    </li>
    <?php endwhile;?>
    </ul>

    2) How to get the category name of each post
    3) the wp_thumbnail(); is not working;

    thanks again for your help..

    My mistake. Use the_post_thumbnail();

    http://codex.wordpress.org/Function_Reference/the_post_thumbnail

    Also, category is the_category();

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display posts from different categories in frontpage’ is closed to new replies.